inspect.getsource bug?

2010-12-26 Thread Ciccio
Try this: 1) define a function 'foo' in a script 2) runfile the script from a shell 3) do 'inspect.getsource(foo)' 4) change the source of 'foo' 5) runfile the script from the same shell 6) do 3 again On my 2.6.6 getsource returns twice the same code. I couldn't find very much about this, is

Re: inspect.getsource bug?

2010-12-26 Thread Ciccio
On 26 Dic, 19:24, Ciccio franap...@gmail.com wrote: Try this: 1) define a function 'foo' in a script 2) runfile the script from a shell 3) do 'inspect.getsource(foo)' 4) change the source of 'foo' 5) runfile the script from the same shell 6) do 3 again On my 2.6.6 getsource returns twice

Re: Regular expression for key = value pairs

2010-12-23 Thread Ciccio
I extracted an isolated problem from a slightly more complex situation, that's why I'm using REs. Thank you all for your help, my problem is now solved. -- http://mail.python.org/mailman/listinfo/python-list

Regular expression for key = value pairs

2010-12-22 Thread Ciccio
Hi all, suppose I have: s='a=b, c=d' and I want to extract sub-strings a,b,c and d from s (and in general from any longer list of such comma separated pairs). Some failed attempts: In [12]: re.findall(r'(.+)=(.+)', s) Out[12]: [('a=b, c', 'd')] In [13]: re.findall(r'(.+?)=(.+)', s) Out[13]:

Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'], 'b': ['x']} What I meant

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Il 09/11/2010 16:47, Terry Reedy ha scritto: On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewrite this as bl = [] rg

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Thank you all, this was timely and helpful. francesco -- http://mail.python.org/mailman/listinfo/python-list

upload a file

2006-07-25 Thread ciccio
Dear all, could you give me an help ? I would to upload a file from web using Python. Is there a simple way to do this? I'm using the cgi module and python 2.3. The file to be uploaded is a text file. Thank you for all your suggestions, Ernesto

Re: capture the output

2006-07-21 Thread ciccio
On 7/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 7/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear all, I'm executing a program by os.spawnv() function. However the program print out several things. I would to capture this output, but I don't know how. Could you give me a

capture the output

2006-07-19 Thread ciccio
Dear all, I'm executing a program by os.spawnv() function. However the program print out several things. I would to capture this output, but I don't know how. Could you give me a suggestion? Thank you Ernesto - This mail sent through IMP:

Re: capture the output

2006-07-19 Thread ciccio
On 7/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear all, I'm executing a program by os.spawnv() function. However the program print out several things. I would to capture this output, but I don't know how. Could you give me a suggestion? Thank you Ernesto Hi Ernesto could you use

problem in executing a file

2006-07-13 Thread ciccio
Dear all, I'm using python to manage a web-site. In particular, a user insert specific parameters in a form and, then, I recover all parameters and run an executable file according to the user parameters. The output is finally showed in a new web-page. The problem is when I need to run the

help to install MySQL-python module

2006-06-07 Thread ciccio
Dear python users, I have an account on a Linux Cluster. I installed python version 2.3.5 on my account. I need to install the module MySQL-python to interact with a MySQL server already installed on the cluster. However, I read the README file but running python setup.py build the system