windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Gelonida
Hi, What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. The reason I am asking is, that I'd like to create a directory structure where multiple users should be allowed to read /

Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Gelonida
On 6/26/2011 11:24 PM, Irmen de Jong wrote: On 26-6-2011 22:57, Gelonida wrote: Hi, What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. The reason I am asking is, that I'd li

Re: windows 7 create directory with read write execute permission for everybody

2011-06-27 Thread Gelonida
Hi Tim, On 6/27/2011 9:39 AM, Tim Golden wrote: On 26/06/2011 21:57, Gelonida wrote: Hi, What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. . . . I never used / modified

Re: windows 7 create directory with read write execute permission for everybody

2011-06-27 Thread Gelonida
On 6/27/2011 7:21 AM, Thorsten Kampe wrote: * Gelonida (Sun, 26 Jun 2011 22:57:57 +0200) What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. Exactly nothing (except creating the

debugging segfaults in pythen PyQt (QWebview)

2011-03-03 Thread Gelonida
Hi, I have a QWebview application, which segfaults rather often, but not all the time. I assume it is some kind of race condition when loading a certain web page with quite some built in AJax. How can I debug it? The application crashes under Windows and under Linux. I enabled already core

Good literature about python twisted

2011-03-15 Thread gelonida
Hi, Just wanted to learn more about python twisted and wanted to buy the O'Reilly book. However I noticed, that the book is from 2005. Is this book still worth it or is there anything better to learn about twisted. I though about buying a paper book in order to be able to read in in the train.

Re: Good literature about python twisted

2011-03-15 Thread gelonida
On Mar 15, 2:18 pm, Daniel Mahoney wrote: > On Tue, 15 Mar 2011 04:34:52 -0700, gelonida wrote: > > Hi, > > > Just wanted to learn more about python twisted and wanted to buy the > > O'Reilly book. > > > However I noticed, that the book is from 2005. > &g

first attempt with pybluez on XP fail

2010-11-16 Thread gelonida
Hi, Wanted to write a first simple example with pybluez and offer a serial connection service with a given name. What I tried (being inspired by http://people.csail.mit.edu/albert/bluez-intro/x290.html ) is: server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) port = bluetooth.PORT_ANY # o

first attempts with pybluez on Win XP fail

2010-11-16 Thread Gelonida
Hi, My post from Google groups doesn't sem to get through. SO here once more posted from gmane. Wanted to write a first simple example with pybluez and offer a serial connection service with a given name. What I tried (being inspired by http://people.csail.mit.edu/albert/bluez-intro/x290.html )

first attempts with pybluez on Linux fail as well

2010-11-17 Thread Gelonida
Hi, Wanted to write a first simple example with pybluez and offer a serial connection service with a given name. What I tried (being inspired by http://people.csail.mit.edu/albert/bluez-intro/x290.html ) is: server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) port = bluetooth.PORT_ANY # o

simplest way to create simple standalone wsgi server without import wsgi_lib.server

2011-01-31 Thread Gelonida
Hi, Normally I use following code snippet to quickly test a wsgi module without a web server. import wsgi_lib.server wsgi_lib.server.run(application, port=port) However Now I'd like to test a small wsgi module on a rather old host ( Python 2.4.3 ) where I don't have means to update python. Is

test: please ignore

2011-02-01 Thread Gelonida
Somehow I can't post anymore to gmane. Would like to know why. -- http://mail.python.org/mailman/listinfo/python-list

Re: simplest way to create simple standalone wsgi server without import wsgi_lib.server

2011-02-01 Thread Gelonida
On 02/01/2011 03:07 AM, Jean-Paul Calderone wrote: > On Jan 31, 5:28 pm, Gelonida wrote: >> Hi, >> >> Normally I use following code snippet to quickly test a wsgi module >> without a web server. >> >> import wsgi_lib.server >> wsgi_lib.server.run(appli

Re: test: please ignore

2011-02-01 Thread Gelonida
On 02/01/2011 10:44 PM, Gelonida wrote: > Somehow I can't post anymore to gmane. > > Would like to know why. > Now this message arrived. So it seems to work again, though with quite some heavy delay. -- http://mail.python.org/mailman/listinfo/python-list

Re: simplest way to create simple standalone wsgi server without import wsgi_lib.server

2011-02-01 Thread Gelonida
On 02/01/2011 11:36 PM, Jean-Paul Calderone wrote: >> >>> twistd -n web --port --wsgi >> >> >> The problem is rather simple. The host in question is not 100% under my >> control. I can request to have packages installed if they're in the list >> of available packages. >> >> python 2.4 is part

PyQT: QWebView with custom QNetworkAccessManager

2011-02-01 Thread Gelonida
Hi, I would like to subclass QNetworkAccessManager and create a subclass of QWebView, that will use the subclassed QNetworkAccessManager for all accesses. Is this possible? I have really no idea when and how I could achieve this. Thanks in advance for any suggestions / pointers -- http://mail.

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-01 Thread Gelonida
On 02/02/2011 12:31 AM, Gelonida wrote: > Hi, > > I would like to subclass QNetworkAccessManager and > create a subclass of QWebView, that will use the subclassed > QNetworkAccessManager for all accesses. > > Is this possible? > I have really no idea when and

How to debug a problem with python crashing under windows

2011-02-04 Thread gelonida
Hi, I have a python application, which occasionally crashes. With crashing I mean, that windows pops up a screen saying, that python.exe failed. I do not have any usable trace on stdout / stderr. What are the best means to analyze such errors? Is there any way to get something like a core dump

QWebView: notify python when I clicked on a certain web eleemnt

2011-02-19 Thread Gelonida
I have a web page (existing page, can't modify it) and I would like to browse it in a QtWebview. (This is already working) Now I Wonder how I could achieve following behaviour: When I click on a certain element e.g. "" I would like to notify my python script. What is important: I don't want to c

How to log certain web requests.

2011-02-19 Thread Gelonida
Hi, I created a small browser with QWebview I subclassed QNetworkAccessManager with a customized version and set it as NetworAccessManager By adding a print / log statement in the createRequestMethod I am able to log, which requests are performed. What I would be interested in is however to t

QWebView: Get coordinates of an element and simulate a relative to this position.

2011-02-19 Thread Gelonida
WHht I wondered is following: Let's assume I use a QWebView, As soon as the page is loaded ( loadFinished signal) I'd like to identify a certain element with findFirstElement(), get it's coordinates (and size) calculate some related coordinates (for example 20 pixel above the top left corner of

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Hi Damjan, Thanks for your answer On 02/21/2011 05:09 PM, Дамјан Георгиевски wrote: >> I have a web page (existing page, can't modify it) and I would like >> to browse it in a QtWebview. (This is already working >> When I click on a certain element e.g. "" >> I would like to notify my python scr

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Damjan, Thanks once more for your help. You pointed me in the right direction. On 02/24/2011 12:25 AM, Ian Kelly wrote: > On Wed, Feb 23, 2011 at 4:02 PM, Gelonida wrote: >>> so make a Python object with some methods you'd wish to call, then >>> evaluate some small J

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Thanks Ian, Pls see my other reply. Is that what you meant? On 02/24/2011 12:25 AM, Ian Kelly wrote: > On Wed, Feb 23, 2011 at 4:02 PM, Gelonida wrote: >>> so make a Python object with some methods you'd wish to call, then >>> evaluate some small JS that will bi

when should I explicitely close a file?

2010-04-13 Thread gelonida
Hi, I've been told, that following code snippet is not good. open("myfile","w").write(astring) , because I'm neither explicitely closing nor using the new 'with' syntax. What exactly is the impact of not closing the file explicitely (implicitley with a 'with' block)? Even with my example I'd

python wia and RegisterEvent

2010-04-15 Thread gelonida
Hi, I'd like to register an event in order to be informed, whenever a Windows WIA device is connected or disconnected. In python I can use WIA devices, but I don't know how to register events I have existing C# code, which works and looks like. class MgrHandlerClass { public void

Re: python wia and RegisterEvent

2010-04-16 Thread gelonida
Hi Mark, On Apr 16, 3:16 am, Mark Hammond wrote: > On 16/04/2010 7:15 AM,gelonidawrote: > > The model used by pywin32 is more "low level" than that exposed by some > of the MS languages.  You probably need something closer to: > >   class MgrHandlerClass: >        def OnEvent(self, EventID=defaul

find out whther byte two .pyc files contain the same byte code.

2010-05-05 Thread gelonida
Hi, I'd like to know whether the byte code of two .pyc files is identical. I thought, I could just compare the md5sums of thw .pyc files. However this does not work. It seems, that .pyc ontains the time stamp of the source file. the .pyc file changes its contents when I don't change the file's c

simples setup for an wsgi https server in python

2010-07-10 Thread Gelonida
Hi, I'd like to debug a small wsgi module. I run it either on an apache web server or locally via wsgiref.simple_server.make_server and following code snippet: from wsgiref.simple_server import make_server httpd = make_server('localhost',8012,application) while True: httpd.handle_request()

how to determine whether pathname1 is below bathname2

2010-07-11 Thread Gelonida
Hi, I wanted to figure out whether a given path name is below another path name. Surprisingly this turned out to be more difficult than initially anticipated: Let's assume I want to find out, whether path1 is below path2 First I thought about checking whether path1 starts with path2 For this

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Gelonida
Hi Thomas, Thomas Jollans wrote: > On 07/11/2010 03:37 PM, Gelonida wrote: >> # >> import os >> def is_below_dir(fname,topdir): >> relpath = os.path.relpath(fname,topdir) >> return not relpath.startswith(

Re: multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread Gelonida
Hi lkcl, Do you have any documentation or overview for your project? Questions I would be interested in: - List of features already working - list of features under development - list of features being in in the near future lkcl wrote: > for several reasons, i'm doing a cooperative multi-ta

pyqt Error with qtdesigner button groups

2010-07-24 Thread Gelonida
Hi, I have have a layout with qt designer, which contains radio buttons. Now I want to add three buttons into a button group. doing this manually works fine with manually I mean adding a few lines in my widget class. example: bg = self.buttongroup = Qg.QButtonGroup() bg.addButton(self.rad

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Gelonida
Hi Edward, On 07/25/2010 04:40 AM, Edward Diener wrote: > I found the solutions too exotic for actual use, and completely > ineffectual for the cases I originally cited. The people in that thread > seem to have completely forgotten that Python can be invoked externally > and internally both throu

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Gelonida
On 07/25/2010 02:46 PM, Edward Diener wrote: > On 7/25/2010 6:07 AM, Gelonida wrote: >> Hi Edward, >> >> There the windows solution could be something like a small 'pystarter' >> program, which would decide depending on the file's location / the >>

Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida
>> >> Thus my idea of having a pystarter with a config file >> mentioning which directories (tools) should use which python executable > > Well, good luck ! I don;t know how this is resolved for you when some > scripts executes 'python xxx yyy' or 'someScript.py yyy'. both could be resolved with

Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida
On 07/25/2010 10:39 PM, MRAB wrote: > News123 wrote: >> Thus my idea of having a pystarter with a config file >> mentioning which directories (tools) should use which python executable >> > I think that's the wrong way round. A pystarter should ask the _tool_ > which version of Python it needs.

Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida
On 07/26/2010 06:36 AM, Edward Diener wrote: > > I start a Python script for version X by going to X's root directory and > invoking 'python someScript.py' from the command line. Does that not > sound reasonable ? Do you have an example of two (not self written) applications requiring to change t

how to build same executabl with and without console output

2010-07-30 Thread Gelonida
Hi, What I'd like to achieve ideally is to create a py2exe program, which will only display a window (so 'compiled' as 'windows'-application) if called normally. however if being called with the option --debug it should display the graphical window plus a debug console where I can print to. I

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Gelonida
Hi, On 07/30/2010 03:51 PM, Dave Angel wrote: > pyt...@bdurham.com wrote: >>> Is there any trick in adding a console window to an application, that >>> was built as 'windows' application? ,,, >>> Since we're talking MS Windows here, see: > > http://msdn.microsoft.com/en-us/library/ms682528(VS.85)

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Gelonida
On 07/30/2010 11:00 AM, Jimmy Retzlaff wrote: > On Fri, Jul 30, 2010 at 1:10 AM, Gelonida wrote: >> What I'd like to achieve ideally is to create a py2exe program, >> which >> will only display a window (so 'compiled' as 'windows'-application) if >

cscope like source code navigation for python code

2010-08-07 Thread Gelonida
Hi, I'm using g?vim and its c-scope plugin for browsing C-code. What would be a good way of navigating larger python projects with vim? thanks for any suggestions -- http://mail.python.org/mailman/listinfo/python-list

Re: cscope like source code navigation for python code

2010-08-08 Thread Gelonida
On 08/08/2010 01:42 AM, Tim Harig wrote: > On 2010-08-07, Gelonida wrote: >> I'm using g?vim and its c-scope plugin for browsing C-code. >> What would be a good way of navigating larger python projects with vim? > > ctags: > http://ctags.sourceforge.net/

Re: cscope like source code navigation for python code

2010-08-08 Thread Gelonida
Hi Thomas, On 08/08/2010 01:27 PM, Thomas Jollans wrote: > On 08/07/2010 07:53 PM, Gelonida wrote: >> Hi, >> >> I'm using g?vim and its c-scope plugin for browsing C-code. >> >> What would be a good way of navigating larger python projects with vi

segfault with small pyqt script

2010-08-11 Thread Gelonida
Hi Guys, I'm desperate. I'm having a real application, which fails rather often when finishing it. I'm not sure, whether any serious problem could be hidden behind it The script is a pyqt script, which segfaults most of the time on my ubuntu 10.4 linux 64 bit and I'm having trouble to understand w

Re: segfault with small pyqt script

2010-08-11 Thread Gelonida
Jusy FYI: I made further tests and can crash the python script even if I delete the linesassigning strings to variables a to f On 08/12/2010 01:07 AM, Gelonida wrote: > Hi Guys, > I'm desperate. I'm having a real application, which fails rather often > when finishing it. I&

Re: segfault with small pyqt script

2010-08-13 Thread Gelonida
Lee, On 08/13/2010 12:53 AM, Lee Harr wrote: > >> I'm desperate. I'm having a real application, which fails rather often >> when finishing it. I'm not sure, whether any serious problem could be >> hidden behind it >> >> The script is a pyqt script, which segfaults most of the time on my >> ubuntu

Re: segfault with small pyqt script

2010-08-13 Thread Gelonida
On 08/13/2010 09:11 AM, Gelonida wrote: > Lee, > > On 08/13/2010 12:53 AM, Lee Harr wrote: >> >>> I'm desperate. I'm having a real application, which fails rather often >>> when finishing it. I'm not sure, whether any serious problem could be &

Re: segfault with small pyqt script

2010-08-13 Thread Gelonida
On 08/13/2010 09:11 AM, Gelonida wrote: > Lee, > > On 08/13/2010 12:53 AM, Lee Harr wrote: >> >>> I'm desperate. I'm having a real application, which fails rather often >>> when finishing it. I'm not sure, whether any serious problem could be &

Re: segfault with small pyqt script

2010-08-16 Thread Gelonida
hon-qt4-4.7.4-1.1 > doesn't show this behavior. > > Pete The problem seems to be known for 4.7.2. For simple code I managed to work around the issue. For the real more complicated I didn't. So it seems I'll have to avoid 4.7.2. Please see below: On 08/13/2010 09:11 AM, Gelonida wr

controlling the mouse pointer on linux (or as vnc client)

2010-08-29 Thread Gelonida
Hi, >From a python script I'd like to be able to move the mouse to certain absolute coordinates on the screen. There's no problems calling an external program with subprocess.popen, as I do not want to perform many movements. The mouse can jump it doesn't have to visibly move to the target coor

Re: controlling the mouse pointer on linux (or as vnc client)

2010-08-29 Thread Gelonida
Hi John, > Hi, > >>From a python script I'd like to be able to move the mouse to certain > absolute coordinates on the screen. > > > There's no problems calling an external program with subprocess.popen, > as I do not want to perform many movements. > > The mouse can jump it doesn't have to vi

Windows: getting notification about power state changes

2010-10-19 Thread Gelonida
Hi, I wondered how I could achieve this. I'd like to be notified about certain events and call certain python functions depending on the event. call a function: - before (or after) the screen saver kicks in - before (or after) the monitor is switched off - before (or after) the hard disk is swi

Re: Windows: getting notification about power state changes

2010-10-20 Thread Gelonida
Hi Tim, Thanks a lot. I'll look into it. On 10/19/2010 11:30 AM, Tim Golden wrote: > On 19/10/2010 10:06, Gelonida wrote: >> I'd like to be notified about certain events and call certain python >> functions depending on the event. >> >> call a function: &g

Re: lazy evaluation of a variable

2012-06-18 Thread Gelonida N
On 06/17/2012 11:35 PM, Gelonida N wrote: Hi, I'm not sure whether what I ask for is impossible, but would know how others handle such situations. I'm having a module, which should lazily evaluate one of it's variables. Meaning that it is evaluated only if anybody tries to us

Re: Conditional decoration

2012-06-19 Thread Gelonida N
On 06/19/2012 02:23 AM, Rob Williscroft wrote: Roy Smith wrote in news:jro9cj$b44$1...@panix2.panix.com in gmane.comp.python.general: Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view ge

Re: Finding absolute path of imported module?

2012-06-19 Thread Gelonida N
On 06/19/2012 09:32 PM, Christian Heimes wrote: Am 19.06.2012 19:55, schrieb Roy Smith: So, the question is, is there any way to dump all the *absolute* pathnames of all the imported modules? I can iterate over sys.modules.values(), but that doesn't give me absolute pathnames, so I can't tell w

howto do a robust simple cross platform beep

2012-07-13 Thread Gelonida N
Hi, I just want to use a beep command that works cross platform. I tried the simplest approach (just printing the BEL character '\a' chr(7) to the console. This fails on my Ubuntu 12.04 host, as the pcspkr is in the list of the blacklisted kernel modules. I found another snippet trying

Re: howto do a robust simple cross platform beep

2012-07-24 Thread Gelonida N
On 07/15/2012 03:15 AM, rantingrickjohn...@gmail.com wrote:> On Friday, July 13, 2012 8:00:05 PM UTC-5, gelonida wrote: >> I just want to use a beep command that works cross platform. [...] I >> just want to use them as alert, when certain events occur within a >> very

find out whether a module exists (without importing it)

2012-08-06 Thread Gelonida N
Is this possible. let's say I'd like to know whether I could import the module 'mypackage.mymodule', meaning, whther this module is located somewhere in sys.path i tried to use imp.find_module(), but it didn't find any module name containing a '.' Am I doing anything wrong? Is there another e

Re: find out whether a module exists (without importing it)

2012-08-06 Thread Gelonida N
On 08/06/2012 11:58 PM, Miki Tebeka wrote: imp.find_module(), but it didn't find any module name containing a '.' The docs (http://docs.python.org/library/imp.html#imp.find_module) clearly say: "This function does not handle hierarchical module names(names > containing dots). Thanks, Well this

Re: find out whether a module exists (without importing it)

2012-08-07 Thread Gelonida N
s, but is broken" raise exc amodule.do_something() You just want to know it module xyz exists, or better said can be found (sys.path). why not try - except[ - else ] try: import mymodule except ImportError: # NOW YOU KNOW it does not exist #+ and you may react properly ??

Re: save dictionary to a file without brackets.

2012-08-09 Thread Gelonida N
On 08/09/2012 10:11 PM, giuseppe.amatu...@gmail.com wrote: Hi, I have a dict() unique like this {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} and i want to print to a file without the brackets comas and semicolon in order to obtain something like this? 4 5 1 5 4 1 4 4 2 2 3 1 4 3 2 Any

Does anyone have an activate script for portable python?

2012-08-11 Thread Gelonida N
Hi, In Pythons installed with virtualenv there is on windows an activate.bat script, that can be used to setup the cmd-shell such, that the search path for python and pythor elated tools (pip / easy_install) is setup properly. Further there is the deactivate script to set the environment ba

suggesting a launcher wrapper script for portable python

2012-08-11 Thread Gelonida N
I just started looking at portable Python and was rather surprised, that I didn't find any recommended method in the documentation of how to launch scripts with portable python. Creating py2exe scripts on ones own USB drive seems to be kind of overkill. So here my own thoughts / suggestsions. I'

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Gelonida N
Hi Thomas, On 08/12/2012 09:05 PM, Thomas Jollans wrote: On 08/12/2012 02:49 AM, Gelonida N wrote: One minor drawback of my suggested script would be, that a console window pops up for a few seconds when starting a .pyw file. (I'm no expert but) This should be avoidable if you us

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Gelonida N
On 08/12/2012 09:52 PM, Mark Lawrence wrote: On 12/08/2012 01:49, Gelonida N wrote: I think it would be great if the official portable python release contained some upport for launching scripts. Perhaps it exists alrady and I just didn't find it? If not,then I wouldn't mind if my

Re: Does anyone have an activate script for portable python?

2012-08-13 Thread Gelonida N
On 08/13/2012 02:12 AM, alex23 wrote: On Aug 12, 9:09 am, Gelonida N wrote: In Pythons installed with virtualenv there is on windows an activate.bat script, that can be used to setup the cmd-shell such, that the search path for python and pythor elated tools (pip / easy_install) is setup

Re: Looking for an IPC solution

2012-09-06 Thread Gelonida N
On 08/31/2012 11:05 PM, Antoine Pitrou wrote: Laszlo Nagy shopzeus.com> writes: How about the standard multiprocessing module? It supports shared memory, remote processes, and will most probably work under PyPy: http://docs.python.org/library/multiprocessing.html I always thought, that th

Re: Looking for an IPC solution

2012-09-06 Thread Gelonida N
On 08/31/2012 11:05 PM, Antoine Pitrou wrote: Laszlo Nagy shopzeus.com> writes: How about the standard multiprocessing module? It supports shared memory, remote processes, and will most probably work under PyPy: http://docs.python.org/library/multiprocessing.html I always thought, that the

Re: Looking for an IPC solution

2012-09-06 Thread Gelonida N
On 08/31/2012 11:05 PM, Antoine Pitrou wrote: Laszlo Nagy shopzeus.com> writes: How about the standard multiprocessing module? It supports shared memory, remote processes, and will most probably work under PyPy: http://docs.python.org/library/multiprocessing.html I always thought, that th

how to run python2.6 module with absolute imports stand alone

2012-09-07 Thread Gelonida N
Hi, many of my modules contain following section at the end def main(): do_something() if __name__ == '__main__': main() This allows me to run some basic example code or some small test in a stand alone mode. My new modules contain following line at the beginning: from __future__ im

Re: Comparing strings from the back?

2012-09-08 Thread Gelonida N
On 09/06/2012 10:33 AM, Steven D'Aprano wrote: On Wed, 05 Sep 2012 22:47:14 +, Oscar Benjamin wrote: I may have been overly-conservative earlier when I said that on average string equality has to compare half the characters. I thought I had remembered that from a computer science textbook, b

Re: Comparing strings from the back?

2012-09-08 Thread Gelonida N
On 09/07/2012 06:06 AM, Steven D'Aprano wrote: On Thu, 06 Sep 2012 06:07:38 -0400, Dave Angel wrote: Also of some interest is the best case: O(1) for unequal strings (they differ at the first character) and O(N) for equal strings. The worst case is O(N) or N characters the average case is O(1

Re: how to run python2.6 module with absolute imports stand alone

2012-09-08 Thread Gelonida N
On 09/08/2012 02:13 AM, Mark Lawrence wrote: On 07/09/2012 23:04, Gelonida N wrote: Hi, many of my modules contain following section at the end def main(): do_something() if __name__ == '__main__': main() This allows me to run some basic example code or some small test

portable way of locating an executable (like which)

2012-09-20 Thread Gelonida N
I'd like to implement the equivalent functionality of the unix command /usr/bin/which The function should work under Linux and under windows. Did anybody already implement such a function. If not, is there a portable way of splitting the environment variable PATH? Thanks for any sugestions --

Re: portable way of locating an executable (like which)

2012-09-20 Thread Gelonida N
On 09/21/2012 12:21 AM, Chris Angelico wrote: On Fri, Sep 21, 2012 at 7:47 AM, Mark Lawrence wrote: On 20/09/2012 22:06, Gelonida N wrote: I'd like to implement the equivalent functionality of the unix command /usr/bin/which The function should work under Linux and under windows.

Re: portable way of locating an executable (like which)

2012-09-20 Thread Gelonida N
On 09/21/2012 12:04 AM, Jason Swails wrote: Thanks a lot Jason, I've used the following in programs I write: def which(program): def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) fpath, fname = os.path.split(program) if fpath: if is_exe

PIL questions: still supported? Problems on 2.7 for win? alternatives?

2012-09-24 Thread Gelonida N
Hi, I'm trying to migrate a project with legacy code from 2.6 (with PIL 1.1.6) to 2.7 with (PIL 1.1.7) The SW should run on Windows. PIL fails with an error concering '_imagingft' This seems to be a known issue. http://code.google.com/p/pythonxy/issues/detail?id=300 and the bug was never clo

Re: PIL questions: still supported? Problems on 2.7 for win? alternatives?

2012-09-25 Thread Gelonida N
On 09/25/2012 01:38 AM, alex23 wrote: On Sep 25, 6:04 am, Gelonida N wrote: This all does not sound very comforting. Why is there no fix on the official site? Has a bug been logged about the issue? The Plone community keeps a fairly up-to-date fork called Pillow, we've had a lot of su

mimetypes.guess_type broken in windows on py2.7 and python 3.X

2012-09-26 Thread Gelonida N
Hi, I'm still experiencing the pleasure of migrating legacy code from Python 2.6. to 2.7 which I expected to be much less painful. (In fact migration on Linux is rather smooth, but Windows is another story) Let's take the simple command import mimetypes print mimetypes.guess_type('a.jpg')

Re: PIL questions: still supported? Problems on 2.7 for win? alternatives?

2012-09-26 Thread Gelonida N
On 09/25/2012 02:42 PM, alex23 wrote: On Sep 25, 6:25 pm, Gelonida N wrote: So it seems to be safe to use either Christoph' binary PIL distribution or to use Pillow. The fact, that pillow is accessable via PyPi / easy_install / PIP pushes me slightly towards pillow. I assume it'

templating performance

2012-09-26 Thread Gelonida N
http://mindref.blogspot.fr/2012/07/python-fastest-template.html -- http://mail.python.org/mailman/listinfo/python-list

Re: templating performance

2012-09-27 Thread Gelonida N
On 09/27/2012 02:17 AM, alex23 wrote: On Sep 27, 7:50 am, Gelonida N wrote: http://mindref.blogspot.fr/2012/07/python-fastest-template.html This is already being discussed on the list. See the thread "Fastest template engine". Apologies everybody, I wanted to 'bookkmark

Re: SSH Connection with Python

2012-10-26 Thread Gelonida N
On 10/25/2012 12:47 PM, Kamlesh Mutha wrote: You can use paramiko module. Very easy to use. I also use paramiko for a small script. However I'm a little hesitant to use paramik for new code. The web page says: "last updated 21-May-2011" and the github url http://github.com/robey/paramiko/

Re: SSH Connection with Python

2012-10-27 Thread Gelonida N
On 10/27/2012 02:21 AM, Roy Smith wrote: In article , Gelonida N wrote: Another problem is, that paramiko depends on pycrypto 2.1+ which doesn't exist as binary release for python 2.7 I'm running paramiko-1.7.6 with python 2.7.3 on my Ubunto Precise box. I'm reasonably sur

Re: attaching names to subexpressions

2012-10-27 Thread Gelonida N
On 10/27/2012 04:42 AM, Steve Howell wrote: > I have been reading the thread "while expression feature proposal," > and one of the interesting outcomes of the thread is the idea that > Python could allow you to attach names to subexpressions, much like C > allows. In C you can say something like

Re: SSH Connection with Python

2012-10-28 Thread Gelonida N
On 10/28/2012 02:35 AM, Cameron Simpson wrote: On 27Oct2012 14:18, Gelonida N wrote: | On 10/27/2012 02:21 AM, Roy Smith wrote: | > In article , | > Gelonida N wrote: | > | >> Another problem is, that paramiko depends on pycrypto 2.1+ | >> which doesn't exist as bin

Re: SSH Connection with Python

2012-10-28 Thread Gelonida N
On 10/26/2012 05:22 AM, Jason Friedman wrote: how can i create a SSH-Connection with python? I have to send some commands to the remote host and parse their answers. Consider also the sh module: http://amoffat.github.com/sh/tutorials/2-interacting_with_processes.html. Just a minor comment:

Re: SSH Connection with Python

2012-10-29 Thread Gelonida N
On 10/29/2012 04:18 PM, David Robinow wrote: On Sun, Oct 28, 2012 at 4:09 PM, Gelonida N wrote: The only thing I'm concerned about paramiko is, that I don't see any activity on the paramiko site and that one library it depends on is not available is windows binary package for newer v

Re: SSH Connection with Python

2012-10-29 Thread Gelonida N
On 10/29/2012 02:10 PM, Roy Smith wrote: In article , Gelonida N wrote: The sh module looks intersting, but it's not supported for Windows platforms. "The X module looks interesting but it's not supported for Windows" is true for many values of X. It's all p

windows question: default click action points to wrong python version

2012-11-21 Thread Gelonida N
Hi, I installed python 2.6 and python 2.7 on a windows 7 machine. At the moment Python 2.7 is the interpreter being used if I 'start' a python script without explicit interpreter. I always thought, that 'repairing' Python 2.6 (reinstalling it) would set the default settings back to Python 2.

Re: windows question: default click action points to wrong python version

2012-11-21 Thread Gelonida N
Hi Tim, Thanks a lot for your answer. On 11/21/2012 10:34 AM, Tim Golden wrote: On 21/11/2012 08:23, Gelonida N wrote: Hi, I installed python 2.6 and python 2.7 on a windows 7 machine. At the moment Python 2.7 is the interpreter being used if I 'start' a python script withou

Re: generate Windows exe on Linux

2012-02-22 Thread Gelonida N
On 02/22/2012 07:05 PM, Alec Taylor wrote: > http://www.pyinstaller.org/ > > or > > http://cx-freeze.sourceforge.net/ > > You can also run py2exe in WINE > You want to say, that I could install python 2.6 some packages like win32api PyQt and tand py2exe under Wine and then compile it. Did yo

Abort an HTTP request before the request timed out

2012-02-26 Thread Gelonida N
Hi, I'm working in a small application, which tries to access data on a web server. Normally the request has a timeout of for example 60 seconds conn = httplib.HTTPConnection(server_name, server_port, timeout=60) while True: conn.request("GET", "/my_url.php") try: resp = conn.get

Re: pickle/unpickle class which has changed

2012-03-06 Thread Gelonida N
Hi Peter, A related question. Is there anyhing like a built in signature which would help to detect, that one tries to unpickle an object whose byte code has changed? The idea is to distinguish old and new pickled data and start some 'migration code' fi required The only thing, that I thought

Re: pickle/unpickle class which has changed

2012-03-07 Thread Gelonida N
On 03/07/2012 09:04 AM, Peter Otten wrote: > Gelonida N wrote: > If you know in advance that your class will undergo significant changes you > may also consider storing more stable data in a file format that can easily > be modified, e. g. json. > Good point, that's what I&

How to know that two pyc files contain the same code

2012-03-10 Thread Gelonida N
Hi, I want to know whether two .pyc files are identical. With identical I mean whether they contain the same byte code. Unfortunately it seems, that .pyc files contain also something like the time stamp of the related source file. So though two pyc files contain the same byte code, they will no

How to know that two pyc files contain the same code

2012-03-10 Thread Gelonida N
Hi, I want to know whether two .pyc files are identical. With identical I mean whether they contain the same byte code. Unfortunately it seems, that .pyc files contain also something like the time stamp of the related source file. So though two pyc files contain the same byte code, they will no

Re: How to know that two pyc files contain the same code

2012-03-10 Thread Gelonida N
Hi Steven, On 03/10/2012 11:52 PM, Steven D'Aprano wrote: > > On Sat, 10 Mar 2012 15:48:48 +0100, Gelonida N wrote: > > >> >> Hi, >> >> >> >> I want to know whether two .pyc files are identical. >> >> >> >> With identi

  1   2   >