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
with interpreter /usr/bin/jython The --no-site-packages flag is deprecated; it is now the default behavior. Cannot find file /usr/share/jython/cachedir (bad symlink) New jython executable in /home/gelonida/mypy/bin/jython ERROR: The executable /home/gelonida/mypy/bin/jython is not functioning ERROR: It

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

Re: how to add custom importer after the normal imports

2014-10-10 Thread Gelonida N
On 10/09/2014 04:14 PM, Ian Kelly wrote: I have a use case where I would like to add a custom importer *AFTER* all other import methods have failed. On Oct 9, 2014 6:53 AM, "Gelonida N" mailto:gelon...@gmail.com>> wrote: > I'm using Puthon 2.7 for the given project

Re: CLI framework using python

2014-10-10 Thread Gelonida N
On 10/10/2014 10:43 AM, Rustom Mody wrote: On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote: For calling commands in a slightly nicer way than os.system / sybprocess.Popen you might look at sh or plumbum https://pypi.python.org/pypi/sh https://pypi.python.org/pypi/plumbum

Re: while loop - multiple condition

2014-10-13 Thread Gelonida N
On 10/12/2014 07:08 PM, Shiva wrote: while ans.lower() != 'yes' or ans.lower()[0] != 'y': ans = input('Do you like python?') I personally consider double negations less intuitive than following: while not( ans.lower() == 'yes' and ans.lower()[0] == 'y' ): Reading this line yoy would ha

optionparse: how to add a line break to the help text

2011-09-10 Thread Gelonida N
I'm having a small question about optionparse. Normaly optionparser will format the help text according to the console's width. I just wondered if there is any way to insert a line breakk into an options help text. Example: from optparse import OptionParser parser = OptionParser() parser.add_o

import packet.module without importing packet.__init__ ?

2011-09-10 Thread Gelonida N
Hi, I am little shaky with how exactly python imports packages / modules etc. Is it possible to import a module from a packet without importing its __init__.py ? Full example: == # application.py - print "starting application" import mypacket.module1 # mypacket

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Gelonida N
Hi James, On 09/11/2011 03:12 AM, Rhodri James wrote: > On Sat, 10 Sep 2011 23:16:42 +0100, Rafael Durán Castañeda > wrote: > >> On 10/09/11 22:43, Gelonida N wrote: >>> >>> from optparse import OptionParser >>> >>> parser = Optio

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Gelonida N
Hi Tim, Thanks a lot!!! On 09/11/2011 04:08 AM, Tim Chase wrote: > On 09/10/11 20:54, Gelonida N wrote: >>> Unfortunately the help text is formatted using textwrap, which presumes >>> that the entire text is a single paragraph. To get paragraphs in the >>> help

Re: import packet.module without importing packet.__init__ ?

2011-09-10 Thread Gelonida N
Hi Steven, Thanks for your answer. On 09/11/2011 02:56 AM, Steven D'Aprano wrote: > Gelonida N wrote: >> Is it possible to import a module from a packet without importing its >> __init__.py ? > > Untested, but I think so. But you shouldn't. The solution (if it d

Re: import packet.module without importing packet.__init__ ?

2011-09-11 Thread Gelonida N
Hi Steven, Thanks again for your answer. On 09/11/2011 06:51 AM, Steven D'Aprano wrote: > Gelonida N wrote: > > In your example, you stated that kitchen explicitly imports kitchen.pans and > kitchen.knives. So in that case, take it up with the designer of the > kitchen p

Re: optionparse: how to add a line break to the help text

2011-09-11 Thread Gelonida N
Thanks Ben, On 09/11/2011 07:20 AM, Ben Finney wrote: > Gelonida N writes: > >> Considering, that you posted the snippet in 2007 and this is very >> probably a reocurring problem for any slighty more complicated help >> text it is really a pity, that it did not become of

Re: help regarding re.search

2011-09-15 Thread Gelonida N
Hi Sagar, In order to be able to help you I propose following: On 09/15/2011 06:54 AM, Sagar Neve wrote: . . . > print "hello..Man_Param=%s,Opt_Param1=%s, > Opt_Param2=%s\n" %(Man_Param,Opt_Param1,Opt_Param2) Change above line into > print "hello..Man_Par

cProfile and name spaces.

2011-09-23 Thread Gelonida N
Hi I have following piece of code in file f1.py # f1.py starts here ### def f(): pass def main(): import profile profile.run('f()') if __name__ == '__main__': main() # -- end of f1.py executing f1.py works as expected. Now I have a file f2.py # f2.py star

Hierarchical commnd line parsing / help texts

2011-09-26 Thread Gelonida N
Hi, So far I used optparse.OptionParser for parsing command line arguments for my python scripts. So far I was happy, with a one level approach, where I get only one help text Now I'd like to create a slightly different python script and wondered which approach / module might be best for implemen

Re: Hierarchical commnd line parsing / help texts

2011-09-26 Thread Gelonida N
On 09/26/2011 11:10 AM, Chris Rebert wrote: > On Mon, Sep 26, 2011 at 1:55 AM, Gelonida N wrote: >> Hi, >> >> So far I used optparse.OptionParser for parsing command line arguments >> for my python scripts. So far I was happy, with a one level approach, >> where I

Re: Advise on using logging.getLogger needed.

2011-10-03 Thread Gelonida N
On 10/03/2011 12:12 AM, Steven W. Orr wrote: > I hope I don't sound like I'm ranting :-( > > I have created a module (called xlogging) which sets up logging the way I want > it. I found out that if I set up my logger without a name, then it gets > applied to every logger that is referenced by ever

python logging multiple processes to one file (via socket server)

2011-10-27 Thread Gelonida N
Hi, I have a rather 'simple' problem. Logging from multiple processes to the same file AND be sure, that no log message is lost, 1.) Log multiple processes to one file: -- I have a python program, which I want to log, but which forks several times. Due

save tuple of simple data types to disk (low memory foot print)

2011-10-28 Thread Gelonida N
Hi, I would like to save many dicts with a fixed amount of keys tuples to a file in a memory efficient manner (no random, but only sequential access is required) As the keys are the same for each entry I considered converting them to tuples. The tuples contain only strings, ints (long ints) an

Re: save tuple of simple data types to disk (low memory foot print)

2011-10-29 Thread Gelonida N
On 10/29/2011 03:00 AM, Steven D'Aprano wrote: > On Fri, 28 Oct 2011 22:47:42 +0200, Gelonida N wrote: > >> Hi, >> >> I would like to save many dicts with a fixed amount of keys tuples to a >> file in a memory efficient manner (no random, but only sequential &

Re: save tuple of simple data types to disk (low memory foot print)

2011-10-29 Thread Gelonida N
On 10/29/2011 01:08 AM, Roy Smith wrote: > In article , > Gelonida N wrote: > >> I would like to save many dicts with a fixed amount of keys >> tuples to a file in a memory efficient manner (no random, but only >> sequential access is required) > > There&#x

Re: Get keys from a dicionary

2011-11-11 Thread Gelonida N
On 11/11/2011 02:31 PM, macm wrote: > Hi Folks > > I pass a nested dictionary to a function. > > def Dicty( dict[k1][k2] ): > print k1 > print k2 > > There is a fast way (trick) to get k1 and k2 as string. > > Whithout loop all dict. Just it! > > Regards > > macm I think the ans

Re: Get keys from a dicionary

2011-11-11 Thread Gelonida N
On 11/11/2011 02:31 PM, macm wrote: > > Hi Folks > > > > I pass a nested dictionary to a function. > > > > def Dicty( dict[k1][k2] ): > > print k1 > > print k2 > > > > There is a fast way (trick) to get k1 and k2 as string. > > > > Whithout loop all dict. Just it! > > > > Regards > > > > ma

resolving module name conflicts.

2011-11-11 Thread Gelonida N
Hi, I got some code. - This code contains a package named tests - there are at least 100 references in different python files importing from above mentioned tests package. - the code also imports pytz at one place I get following warning message: /usr/lib/python2.6/dist-packages/pytz/_

Re: resolving module name conflicts.

2011-11-11 Thread Gelonida N
On 11/11/2011 10:31 PM, Emile van Sebille wrote: > On 11/11/2011 12:27 PM Gelonida N said... >> Is there any way to tell pytz to import it's own tests package and tell >> the rest of the code to import the other? >> >> Python version is 2.6.5 >> >

Re: resolving module name conflicts.

2011-11-11 Thread Gelonida N
On 11/11/2011 10:51 PM, Eric Snow wrote: > On Fri, Nov 11, 2011 at 2:34 PM, Eric Snow > wrote: > > So if you run a module as a script, that empty string will be added to > sys.path and all imports will first check the directory you were in > when you ran Python... > Yes that's normal (and for

Re: resolving module name conflicts. (pytz version 2010b)

2011-11-11 Thread Gelonida N
On 11/12/2011 01:42 AM, Steven D'Aprano wrote: > On Fri, 11 Nov 2011 23:11:38 +0100, Gelonida N wrote: > >> Pytz is only imported by one module, so I wondered if there were any >> tricks to 'change sys.path' prior to importing pytz > > sys.path is just

Is there any way to unimport a library

2011-11-20 Thread Gelonida N
I wondered whether there is any way to un-import a library, such, that it's occupied memory and the related shared libraries are released. My usecase is following: success = False try: import lib1_version1 as lib1 import lib2_version1 as lib2 success = True except ImportError:

Re: Is there any way to unimport a library

2011-11-20 Thread Gelonida N
Steven, Mika, Thanks for your answers. It's always good to know which options exist. It makes it easier to choose the right one depending on the situation. On 11/20/2011 04:46 PM, Steven D'Aprano wrote: > On Sun, 20 Nov 2011 16:15:05 +0100, Gelonida N wrote: > >> I won

Re: Is there any way to unimport a library

2011-11-20 Thread Gelonida N
I forgot to mention, that this is at the moment more a thought experiment, than a real need. On 11/20/2011 05:53 PM, Chris Angelico wrote: > On Mon, Nov 21, 2011 at 3:39 AM, Gelonida N wrote: >> No mixing would not be possible. >> >> So either I need the first two l

lxml precaching DTD for document verification.

2011-11-27 Thread Gelonida N
Hi, I'd like to verify some (x)html / / html5 / xml documents from a server. These documents have a very limited number of different doc types / DTDs. So what I would like to do is to build a small DTD cache and some code, that would avoid searching the DTDs over and over from the net. What wou

Re: lxml precaching DTD for document verification.

2011-11-27 Thread Gelonida N
On 11/27/2011 10:33 PM, John Gordon wrote: > In Roy Smith > writes: > >> In article , >> Gelonida N wrote: >> >>> I'd like to verify some (x)html / / html5 / xml documents from a server. > >> I'm sure you could roll your own valida

Re: lxml precaching DTD for document verification.

2011-11-28 Thread Gelonida N
Thanks Stefan, On 11/28/2011 08:38 AM, Stefan Behnel wrote: > Gelonida N, 27.11.2011 18:57: >> I'd like to verify some (x)html / / html5 / xml documents from a server. >> >> These documents have a very limited number of different doc types / DTDs. >> >> So

Re: order independent hash?

2011-12-01 Thread Gelonida N
On 11/30/2011 01:32 PM, Neal Becker wrote: > I like to hash a list of words (actually, the command line args of my > program) > in such a way that different words will create different hash, but not > sensitive > to the order of the words. Any ideas? > Do youmean hash like digest like md5sum

Re: Reading twice from STDIN

2011-12-01 Thread Gelonida N
On 12/01/2011 11:01 AM, janedenone wrote: Hi, > > I would like to read from a pipe, parse the input and ask the user > what to do next: > > message = sys.stdin.read() With above line you said, that you want to read ALL data from stdin, so it's obvious that any following command will be unable

Re: order independent hash?

2011-12-03 Thread Gelonida N
On 12/02/2011 07:39 PM, Dave Angel wrote: > On 12/01/2011 08:55 AM, Neal Becker wrote: >> Gelonida N wrote: >> >>> On 11/30/2011 01:32 PM, Neal Becker wrote: >>>> I like to hash a list of words (actually, the command line args of my >>>> program

Re: Python 2 or 3

2011-12-03 Thread Gelonida N
On 12/03/2011 04:54 AM, Antti J Ylikoski wrote: > > I'm in the process of learning Python. I already can code > objet-oriented programs with the language. I have in my hands the > O'Reilly book by Mark Lutz, Programming Python, in two versions: the > 2nd Edition, which covers Python 2, and the 4

unittest. customizing tstloaders / discover()

2011-12-11 Thread Gelonida N
Hi, I'd like to have a custom test loder, which will filter out certain tests or which just searches tests in certain directories. I'd like to use regular expresions as include / exclude rules and I would like to have another filter function, which would check for the existence of certain metavar

Re: unittest. customizing tstloaders / discover()

2011-12-11 Thread Gelonida N
On 12/12/2011 12:27 AM, Thomas Bach wrote: > Gelonida N writes: > >> I'd like to use regular expresions as include / exclude rules >> and I would like to have another filter function, which would check for >> the existence of certain metavariabels in test suite file

change webcam settings for v4l linux webcams

2013-02-20 Thread Gelonida N
Hi, I'd like to write some code to capture images from a web cam. I found opencv and videocapture. However it seems, that the python opencv API is quite limited. I don't seem to be able to set all parameters (focus,contrast,exposure,. . . ) of a web cam via opencv. Is there any python mod

Re: PyQT: QWebView with custom QNetworkAccessManager

2011-02-02 Thread Gelonida Gmail
Hi Phil, On 02/02/2011 09:28 AM, Phil Thompson wrote: > On Wed, 02 Feb 2011 02:37:06 +0100, Gelonida wrote > > In fact my first experiments failed horribly due to a tiny PyQt detail. > > I expected that, the variable new_manager does not have to be > persistent. >> I naiv

<    1   2