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 long running non GUI applic

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

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

2012-03-11 Thread Gelonida N
On 03/11/2012 08:06 AM, Steven D'Aprano wrote: > What if one merely changed the order of definition? Instead of: > > def foo(): pass > def bar(): pass > > one had this? > > def bar(): pass > def foo(): pass > > It depends on why the OP cares if they are "identical". I can imagine use- > cases w

Is there a ConfigParser which keeps comments

2012-03-14 Thread Gelonida N
Hi, At the moment I use ConfigParser http://docs.python.org/library/configparser.html for one of my applications. Now I'm looking for a library, which behaves like config parser, but with one minor difference. The write() mehtod should keep existing comments. Does anybody know or implement so

Re: Is there a ConfigParser which keeps comments

2012-03-15 Thread Gelonida N
On 03/15/2012 10:42 PM, Cameron Simpson wrote: > On 14Mar2012 13:13, Tim Chase wrote: > | On 03/14/12 12:06, Terry Reedy wrote: > | > On 3/14/2012 6:07 AM, Gelonida N wrote: > | >> Now I'm looking for a library, which behaves like config parser, but > |

best way to create warning for obsolete functions and call new one

2012-03-26 Thread Gelonida N
Hi, I'm working on a module, which needs rather heavy renaming of functions and methods (naming style, change of functionality, understandability, orthography) As these modules are used by quite some projects and as I do not want to force everybody to rename immediately I just want to warn users,

Re: best way to create warning for obsolete functions and call new one

2012-03-28 Thread Gelonida N
Hi Dan, On 03/26/2012 11:24 PM, Dan Sommers wrote: > On Mon, 26 Mar 2012 22:26:11 +0200 > Gelonida N wrote: > >> As these modules are used by quite some projects and as I do not want >> to force everybody to rename immediately I just want to warn users, >> that the

Re: best way to create warning for obsolete functions and call new one

2012-03-28 Thread Gelonida N
Hi Chris, On 03/26/2012 11:50 PM, Chris Angelico wrote: > On Tue, Mar 27, 2012 at 7:26 AM, Gelonida N wrote: >> One option I though of would be: >> >> def obsolete_func(func): >>def call_old(*args, **kwargs): >>print "func is old psl use new one&

virtualenv and jython on Ubuntu 12.04

2012-05-22 Thread Gelonida N
Hi, I wanted to do some first experiments with Jython (which should now be able to run django apps) Thus I wanted to create a virtualenv setup for jython with following command: virtualenv -p jython --no-site-packages ~/mypy However this fails with following output: Running virtualenv with

Install python 2.6 and python 2.7 on Windows

2012-05-22 Thread Gelonida N
I'd like to install python 2.6 and 2.7 on Windows? In fact I have already 2.6 installed and would like to additionally install 2.7 When clicking on .py file I'd like to execute it with python 2.6 If I really wanted to run 2.7 I'd call the code with %SystemDrive%\Python27\Python program.py

install python 2.6 on Ubuntu 12.04

2012-05-22 Thread Gelonida N
Hi, On Ubuntu 12.04 python 2.7 is the default version I'd like to install python 2.6 parallel to 2.7 and create a virtualenv for it. The reason is, that I have to write some code, that will be executed under 2.6 and I want to be sure, that I don't accidentally write code, that would no more

Re: Smallest/cheapest possible Python platform?

2012-05-27 Thread Gelonida N
On 05/27/2012 05:37 PM, Colin J. Williams wrote: On 26/05/2012 12:25 PM, Paul Rubin wrote: Roy Smith writes: The Rasberry Pi certainly looks attractive, but isn't quite available today. Can you run Python on an Arduino? No. YOu want a 32-bit platform with an OS and perhaps 1 meg of memory. An

Re: How to suppress exception printing to console?

2012-05-31 Thread Gelonida N
On 05/31/2012 09:57 AM, Qi wrote: Hi guys, I have an application that embedding Python into C++. When any exception occurred in C++ code, PyErr_SetString will be called to propagate the exception to Python. The problem is, some unit tests trigger exception on intention. So it's OK to have the e

how to typecast a ctypes pointer to another one

2012-06-02 Thread Gelonida N
Hi, I have a result from a call to a ctypes function of type c_void_p. Now I'd like to convert it to a pointer to one of the structures, that I defined. result = library.c_function(params) class MyStruct(ctypes.Structure): _fields_ = [ ('fourbytes', ctypes.c_char * 4) ] I

lazy evaluation of a variable

2012-06-17 Thread Gelonida N
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 use this variable. At the moment I don't know how to do thi

m2crypto https, xmlrpc, keep_alive

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2cryptos xmlrpc The code I'm is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1) svr.myn

m2crypto https, xmlrpc, and cookies

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2cryptos xmlrpc The code I'm using is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1) s

m2crypto https, xmlrpc and ignore server name mismatch

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2crypto's xmlrpc The code I'm using is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1)

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:08 AM, Chris Angelico wrote: > With the local-variable-snapshot technique ("len = len"), can anything > be optimized, since the parser can guarantee that nothing ever > reassigns to it? If not, perhaps this would be a place where something > might be implemented: > > @const(len,ma

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:26 AM, Chris Angelico wrote: > On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N wrote: >> On the other hand: It might be interesting, that the early binding would >> just take place when python is invoked with -O >> > > This could be an excellent safety c

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:26 AM, Chris Angelico wrote: > On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N wrote: >> On the other hand: It might be interesting, that the early binding would >> just take place when python is invoked with -O >> > > This could be an excellent safety c

Text to image with same results on any platform

2011-08-03 Thread Gelonida N
Hi, >From within a django application I'd like create a small image file (e.g. .png) which just contains some text. I wondered what library would be appropriate and would yield the same result independent of the OS (assuming the versions of the python libraries are the same) Images should be pix

Re: PyWart: os.path needs immediate attention!

2011-08-03 Thread Gelonida N
On 07/29/2011 11:43 PM, Chris Angelico wrote: > On Sat, Jul 30, 2011 at 6:44 AM, Corey Richardson wrote: >> Excerpts from rantingrick's message of Fri Jul 29 13:22:04 -0400 2011: >>> * New path module will ONLY support one path sep! >> >> People who use windows are used to \ being their pathsep.

PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Gelonida N
I posted already a question, but perhaps the subject line wasn't clear. Subject line was "Text to image with same results on any platform" >From within a django application I'd like create a small image file (e.g. .png) which just contains some text. I wondered what library would be appropria

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Gelonida N
On 08/04/2011 12:32 PM, Thomas Jollans wrote: > On 04/08/11 12:04, Gelonida N wrote: Thanks for your answer. >> >From within a django application >> I'd like create a small image file (e.g. .png) >> which just contains some text. >> >> I wondered what lib

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Gelonida N
Thanks again to everybody, Your answers helped me to understand better. My pragmatic solution is now to package my program with an open source .ttf font, which will be used on both platforms. On 08/04/2011 10:24 PM, Irmen de Jong wrote: > On 4-8-2011 21:30, Irmen de Jong wrote: > >> As far as

Re: Text to image with same results on any platform

2011-08-04 Thread Gelonida N
Just FYI. Thread continued in thread with the subject line 'PIL question. having exactly same font on multiple platforms' I'm currently not pixel true, but images are sufficiently similiar. On 08/03/2011 11:40 AM, Gelonida N wrote: > Hi, > > >>From within a

Re: can virtualenv run without the main installation?

2011-08-06 Thread Gelonida N
On 08/06/2011 09:38 AM, smith jack wrote: > At first i have a python environment, after using virtualenv test > command, a new environment named test is created, in that directory > have some of the executable commands > such as python.exe, so can i program without the main installation of python?

Re: can virtualenv run without the main installation?

2011-08-06 Thread Gelonida N
On 08/06/2011 09:51 AM, smith jack wrote: > env create by virtualenv will refer to the main env, how did it find > the main env, is there any configuration files, if yes, where is it? > > 2011/8/6 smith jack : >> At first i have a python environment, after using virtualenv test >> command, a new e

Re: can virtualenv run without the main installation?

2011-08-06 Thread Gelonida N
On 08/06/2011 09:51 AM, smith jack wrote: > env create by virtualenv will refer to the main env, how did it find > the main env, is there any configuration files, if yes, where is it? > > 2011/8/6 smith jack : >> At first i have a python environment, after using virtualenv test >> command, a new e

Re: how to separate a list into two lists?

2011-08-06 Thread Gelonida N
On 08/06/2011 08:13 PM, bud wrote: > On Sun, 07 Aug 2011 01:07:00 +0800, smith jack wrote: > >> if a list L is composed with tuple consists of two elements, that is L = >> [(a1, b1), (a2, b2) ... (an, bn)] >> >> is there any simple way to divide this list into two separate lists , >> such that L1

Re: how to separate a list into two lists?

2011-08-07 Thread Gelonida N
On 08/07/2011 02:07 AM, Steven D'Aprano wrote: > Gelonida N wrote: > >> Asuming you [Bud] are not an alias of Jack Smith and assuming you did >> not see Jack's thread asking the same question: > > That's a strange thing to say when Bud *answered* Ja

Re: module import error, what's wrong?

2011-08-07 Thread Gelonida N
On 08/08/2011 02:45 AM, smith jack wrote: > from common.URLTool import URLTool could it be that you meant from common import URLTool As I don't know the module 'common' I am just guessing > tool = URLTool() > > Traceback (most recent call last): > File "E:\workspace\url\test.py", line 7, in

Re: Wait for a keypress before continuing?

2011-08-08 Thread Gelonida N
On 08/08/2011 04:44 AM, John Doe wrote: > Steven D'Aprano wrote: > >> Also, are you using an IDE? If so, it could very well be >> interfering with the keyboard buffer > > I really don't know how to answer your question. I am using > Windows XP SP3. Komodo Edit 6 for editing the *.py file. Dr

just for fun: make a class (not its instances) iterable

2011-08-09 Thread Gelonida N
Hi, I am just curious. There is no real use case: If I have a class and I want that its instances are iterable I can just add a class metohod named __iter__() example: class MyClass(object): def __iter__(self): for val in range(10): yield val

problem installing psyco on windows (Unable to find vcvarsall.bat)

2011-08-10 Thread Gelonida N
Hi, I'd like to install psyco on my windows host I'm using python 2.6.4 (32 bit version) I installed easy_intall and pip easy_install psyco and pip install psyco fail both with the message error: Setup script exited with error: Unable to find vcvarsall.bat I read, that this means I shoul di

ipython installed in virtualenv seems not to use virtualenv

2011-08-11 Thread Gelonida N
Hi, Short version == I have a system with ipython installed by my Ubuntu distribution I created a virtualenv with > virtualenv ~/myenv I installed ipython > pip install ipython --upgrade When using ipython I notice, that it does import the modules from my default python setup and not

Re: problem installing psyco on windows (Unable to find vcvarsall.bat)

2011-08-11 Thread Gelonida N
On 08/11/2011 06:03 AM, Dan Stromberg wrote: Hi Dan, > FWIW, a few months ago I was working on a database application on > Windows, and I benchmarked the psyco-enhanced version consistently > running slower than the non-psyco version. The same code on Linux was > faster with psyco though. Good

Re: ipython installed in virtualenv seems not to use virtualenv

2011-08-11 Thread Gelonida N
'm glad it's working now. Tried to reproduce the issue on another (rather similiar machine), but couldn't > Becky Lewis > > > On Aug 11, 9:59 am, Gelonida N wrote: >> Hi, >> >> Short version >> == >> I have a system wi

Re: problem installing psyco on windows (Unable to find vcvarsall.bat)

2011-08-11 Thread Gelonida N
On 08/11/2011 05:24 AM, Miki Tebeka wrote: > You can download the sources tarball and when building specify the compiler. > See http://docs.python.org/install/index.html#gnu-c-cygwin-mingw Your answer put me on the right track. This works: - downloading mingw - downloading and extracting the tar

Re: ipython installed in virtualenv seems not to use virtualenv

2011-08-11 Thread Gelonida N
On 08/11/2011 12:28 PM, becky_lewis wrote: > Just to add ... > > I ran through creating a virtualenv in the same manner as you: > > > ipython is using the virtualenv when it can find them and the system > wide packages when they are not in the virtualenv. Hope that helps you > track down the pro

Re: SSL module needs issuer information

2011-09-03 Thread Gelonida N
Hi John, On 09/03/2011 08:10 PM, John Nagle wrote: > The SSL module still doesn't return much information from the > certificate. SSLSocket.getpeercert only returns a few basic items > about the certificate subject. You can't retrieve issuer information, > and you can't get the extensions need

Re: Need advice on Web / Database framework...

2011-09-03 Thread Gelonida N
Hi Paul, On 09/03/2011 08:59 PM, Paul Kölle wrote: > Am 03.09.2011 16:11, schrieb Benjamin Schollnick: >> Folks, >> >> I need some advice on a python web& database framework to use...? > Hardest question ever ;) . . . >> But I am concerned at the thought of handcrafting a administration >> interf

Re: Floating point multiplication in python

2011-09-07 Thread Gelonida N
On 09/07/2011 06:51 AM, Steven D'Aprano wrote: 11258999068426240 > > Error in float 1.1*1.1: > b = F(11, 10)**2 y = F.from_float(1.1**2) f = y - b print f > 21/112589990684262400 > > which is slightly more than double e above, and slightly less than our > estimate of 2*a*e =

Re: Prequisites required to learn Django frame work

2011-09-07 Thread Gelonida N
Hi Shambhu, On 09/07/2011 09:25 AM, Shambhu Rajak wrote: > Hi, > > I have been doing python development since last year, I think I should > learn the famous Django frame work. > > > > Can any one suggest what are the perquisite required to setup django on > my local home machine. > Just eas

Py2 + PY3 transform a project (git submodule) to a clean package (with setup.py)

2016-01-15 Thread Gelonida N
Hi, I'm having a git project which contains functionality, that I use in many of my projects. For this posts sake let's call it mylib. if mylib is in the python path, it can be used for quite some convenience function in many of my projects. Examples: from mylib.logging import setupLogging

embedding ipython kernel in a thread

2014-06-09 Thread Gelonida N
Hi, I'd like to embed an ipython kernel in an appliction, such, that I can use ipython console --existing kernel-.json lateron to connect to it and to look at some values Due to various reason I don not want to start it in the main thread. If you look at following example you will see, that

Re: embedding ipython kernel in a thread

2014-06-09 Thread Gelonida N
On 6/9/2014 3:34 PM, Carlos Anselmo Dias wrote: On 06/09/2014 01:59 PM, Gelonida N wrote: Hi, I'd like to embed an ipython kernel in an appliction, such, that I can use ipython console --existing kernel-.json lateron to connect to it and to look at some values Due to various reason

Re: Pythonic way to iterate through multidimensional space?

2014-10-06 Thread Gelonida N
On 8/6/2014 1:39 PM, Tim Chase wrote: On 2014-08-06 11:04, Gayathri J wrote: Below is the code I tried to check if itertools.product() was faster than normal nested loops... they arent! arent they supposed to be...or am i making a mistake? I believe something like this was discussed a while a

Re: Pythonic way to iterate through multidimensional space?

2014-10-08 Thread Gelonida N
On 10/7/2014 1:01 PM, Ned Batchelder wrote: On 10/7/14 2:10 AM, Gelonida N wrote: Disadvantage of itertools.product() is, that it makes a copy in memory. Reason ist, that itertools also makes products of generators (meaning of objects, that one can't iterate several times through) Ther

how to add custom importer after the normal imports

2014-10-08 Thread Gelonida N
Hi, I just read about sys.meta_path, which allows to install custom importers *BEFORE* the default importers. However I have a use case where I would like to add a custom importer *AFTER* all other import methods have failed. Does anybody know how to do this. One way of implementing this

Re: operator module functions

2014-10-08 Thread Gelonida N
On 10/8/2014 9:09 PM, Terry Reedy wrote: On 10/8/2014 6:57 AM, Steven D'Aprano wrote: According to the documentation, operator.__add__ is the "official" function, and operator.add is just there for convenience. You are paraphrasing "The function names are those used for special class methods;

virtualenv question: include just a few site packages

2014-10-08 Thread Gelonida N
virtualenv has the switch --system-site-packages (including all system site pacgaes) and the switch --no-site-packages (to expclude all site packages) Does anyone know an easy way to include just a few site-packages? for example (PySide, but not PyQt) The reason I'm asking is following. Some si

Re: how to add custom importer after the normal imports

2014-10-09 Thread Gelonida N
On 10/9/2014 12:44 AM, Ian Kelly wrote: On Wed, Oct 8, 2014 at 4:53 AM, Gelonida N wrote: Hi, I just read about sys.meta_path, which allows to install custom importers *BEFORE* the default importers. However I have a use case where I would like to add a custom importer *AFTER* all other

Re: virtualenv question: include just a few site packages

2014-10-09 Thread Gelonida N
On 10/09/2014 03:19 PM, Jean-Michel Pichavant wrote: - Original Message - virtualenv has the switch --system-site-packages (including all system site pacgaes) and the switch --no-site-packages (to expclude all site packages) Does anyone know an easy way to include just a few site-packag

Re: CLI framework using python

2014-10-09 Thread Gelonida N
On 10/09/2014 05:25 PM, Unix SA wrote: Hello, Go for Optparse.. Look at below docs on how to use it. http://pymotw.com/2/optparse/ For newer projects I'd suggest argparse (part of Python since 2.7 and can be downloaded / installed for 2.5 / 2.6). https://docs.python.org/2.7/library/argpar

  1   2   >