Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Chris Angelico
On Thu, Sep 22, 2011 at 3:54 PM, Andrew Berg wrote: > The main program is an IRC bot, which could potentially be in use by > many people in several channels on a network. As it is, the bot can only > connect to one server, but it could probably be set up to connect to any > number of networks. Mak

Re: Environment variables not visible from Python

2011-09-21 Thread Hegedüs , Ervin
hello, On Thu, Sep 22, 2011 at 06:12:01AM +, Steven D'Aprano wrote: > I don't understand why some environment variables are not visible from > Python. > > [steve@wow-wow ~]$ echo $LINES $COLUMNS $TERM > 30 140 xterm > [steve@wow-wow ~]$ python2.6 > Python 2.6.6 (r266:84292, Dec 21 2010, 18:1

Re: Environment variables not visible from Python

2011-09-21 Thread Kushal Kumaran
On Thu, Sep 22, 2011 at 11:42 AM, Steven D'Aprano wrote: > I don't understand why some environment variables are not visible from > Python. > > [steve@wow-wow ~]$ echo $LINES $COLUMNS $TERM > 30 140 xterm > [steve@wow-wow ~]$ python2.6 > Python 2.6.6 (r266:84292, Dec 21 2010, 18:12:50) > [GCC 4.1.

Environment variables not visible from Python

2011-09-21 Thread Steven D'Aprano
I don't understand why some environment variables are not visible from Python. [steve@wow-wow ~]$ echo $LINES $COLUMNS $TERM 30 140 xterm [steve@wow-wow ~]$ python2.6 Python 2.6.6 (r266:84292, Dec 21 2010, 18:12:50) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "cred

Re: with statements does not delete the object

2011-09-21 Thread Ben Finney
y...@zioup.com writes: > Is this the expected behaviour: You can learn the expected behaviour for ‘with’ in the documentation http://docs.python.org/reference/compound_stmts.html#the-with-statement>. > with mylib.token() as t: > do_something > > dir() > > In the last dir(), after t

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.22 12:09 AM, Chris Angelico wrote: > On-the-fly reloading of modules isn't really one of Python's > strengths. Everyone who asks about it seems to be doing rapid > development/debugging and wanting to save on startup time (as opposed > to, say, running a server and updating code in it wh

with statements does not delete the object

2011-09-21 Thread yves
Is this the expected behaviour: with mylib.token() as t: do_something dir() In the last dir(), after the with "loop" is finished, t still shows up... I expected it to be unreferenced by then. -- Yves. http://www.SollerS.ca/

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Chris Angelico
On Thu, Sep 22, 2011 at 2:47 PM, Andrew Berg wrote: > This makes me wonder what else stays around after a reload and what side > effects there are, though. I would really like to purge everything from > the previous import. The main program has no dependence on the module > whatsoever. > On-the-f

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Atherun
On Sep 21, 8:58 pm, Roy Smith wrote: > In article , >  Chris Rebert wrote: > > > Popen.poll(): > >     Check if child process has terminated. Set **and return** > > returncode attribute. > > [Direct quote from the docs; emphasis added] > > Doh.  I read right past that and didn't see it.  Thanks f

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.21 11:22 PM, Steven D'Aprano wrote: > You could > try something like this (untested): That works. Thanks! This makes me wonder what else stays around after a reload and what side effects there are, though. I would really like to purge everything from the previous import. The main progra

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Steven D'Aprano
On Wed, 21 Sep 2011 20:53:04 -0500, Andrew Berg wrote: > When using a logger in a module and then using imp.reload to reload the > module, logger messages are repeated in direct proportion to the number > of times the modules was loaded. That is, on the first import, the > message is written once,

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Roy Smith
In article , Chris Rebert wrote: > Popen.poll(): > Check if child process has terminated. Set **and return** > returncode attribute. > [Direct quote from the docs; emphasis added] Doh. I read right past that and didn't see it. Thanks for the correction. -- http://mail.python.org/mailman

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Chris Rebert
On Wed, Sep 21, 2011 at 8:32 PM, Roy Smith wrote: > My reading of the docs > (http://docs.python.org/release/2.6.7/library/subprocess.html#popen-objec > ts) says that Popen.poll() doesn't return a value, it sets the object's > return code attribute, which you can then interrogate. Popen.poll():

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Atherun
On Sep 21, 8:33 pm, Chris Rebert wrote: > On Wed, Sep 21, 2011 at 8:09 PM, Atherun wrote: > > This is on windows with python 2.6. > > I can't seem to remove a possibility of a  deadlock in one of my > > scripts at the moment.  Its not a constant deadlock but it appears > > from time to time.  The

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Roy Smith
In article <098f3d78-85f5-44e7-ba72-f2270a24d...@o9g2000vbo.googlegroups.com>, Atherun wrote: > This is on windows with python 2.6. > I can't seem to remove a possibility of a deadlock in one of my > scripts at the moment. Its not a constant deadlock but it appears > from time to time. The c

Re: Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Chris Rebert
On Wed, Sep 21, 2011 at 8:09 PM, Atherun wrote: > This is on windows with python 2.6. > I can't seem to remove a possibility of a  deadlock in one of my > scripts at the moment.  Its not a constant deadlock but it appears > from time to time.  The code is below: > > try: > >        process = > sub

Python deadlock using subprocess.popen and communicate

2011-09-21 Thread Atherun
This is on windows with python 2.6. I can't seem to remove a possibility of a deadlock in one of my scripts at the moment. Its not a constant deadlock but it appears from time to time. The code is below: try: process = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOU

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Chris Angelico
On Thu, Sep 22, 2011 at 12:44 PM, Andrew Berg wrote: > The reload isn't controlled by the module, but I have no problem > clearing out any loggers at the beginning. I'm thinking more along the lines of closing them in the old module before firing imp.reload() - maybe have a function in the module

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.21 08:57 PM, Chris Angelico wrote: > Unfortunately, Python doesn't really like modules to be reloaded. Are > you able to explicitly close the logger before reloading? The reload isn't controlled by the module, but I have no problem clearing out any loggers at the beginning. I'm looking t

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Chris Angelico
On Thu, Sep 22, 2011 at 11:53 AM, Andrew Berg wrote: > What causes this, and how can I fix it (or at least work around it)? Due > to the nature of the program, it's much more convenient to reload a > module than to restart the entire program (especially when testing). > Unfortunately, Python does

Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
When using a logger in a module and then using imp.reload to reload the module, logger messages are repeated in direct proportion to the number of times the modules was loaded. That is, on the first import, the message is written once, but on the second run, each message is written twice, three tim

[ANNC] pynguin-0.12 (fixes problems running on Windows)

2011-09-21 Thread Lee Harr
Pynguin is a python-based turtle graphics application.     It combines an editor, interactive interpreter, and     graphics display area. It is meant to be an easy environment for introducing     some programming concepts to beginning programmers. http://pynguin.googlecode.com/ This release f

Re: About MAKE_FUNCTION opcode in Python 3

2011-09-21 Thread Arnaud Delobelle
On 21 September 2011 04:09, Terry Reedy wrote: > I agree that doc should be updated for 3.x. Please suggest a new working if > you can, as well as copying the source snippet above. Add me terry.reedy as > nosy. Done: http://bugs.python.org/issue13026 -- Arnaud -- http://mail.python.org/mailma

Re: Operator commutativity

2011-09-21 Thread Ethan Furman
Steven D'Aprano wrote: After playing around with various combinations of C1, C2, D1 and D2, it seems to me that the rule is: If the right-hand argument is a subclass of the left-hand argument, AND also defines __radd__ directly rather than inheriting it, then its __radd__ method is called before

Re: Where can I find a lexical spec of python?

2011-09-21 Thread Thomas Jollans
On 21/09/11 20:01, Shaofei Cheng wrote: > Yes, I'm using this document now but I was wondering if there is a formal > spec for lexical grammar? It looks like some part of the doc > "http://docs.python.org/py3k/reference/grammar.html"; is missing. > We can find some replacement in lexical_analy

Re:Re: Where can I find a lexical spec of python?

2011-09-21 Thread Shaofei Cheng
Yes, I'm using this document now but I was wondering if there is a formal spec for lexical grammar? It looks like some part of the doc "http://docs.python.org/py3k/reference/grammar.html"; is missing. We can find some replacement in lexical_analysis.html but it seems this document is write fo

Re: Operator commutativity

2011-09-21 Thread Ethan Furman
Mark Dickinson wrote: On Sep 21, 2:07 am, Steven D'Aprano wrote: After playing around with various combinations of C1, C2, D1 and D2, it seems to me that the rule is: If the right-hand argument is a subclass of the left-hand argument, AND also defines __radd__ directly rather than inheriting i

Re: Operator commutativity

2011-09-21 Thread Mark Dickinson
On Sep 21, 2:07 am, Steven D'Aprano wrote: > After playing around with various combinations of C1, C2, D1 and D2, it > seems to me that the rule is: > > If the right-hand argument is a subclass of the left-hand argument, AND also > defines __radd__ directly rather than inheriting it, then its __ra

Re: Re: Where can I find a lexical spec of python?

2011-09-21 Thread Chris Rebert
On Wed, Sep 21, 2011 at 9:33 AM, 程劭非 wrote: > Thanks Thomas. > I've read the document > http://docs.python.org/py3k/reference/lexical_analysis.html > > but I worried it might leak some language features like "tab magic". > > For I'm working on a parser with JavaScript I need a more strictly defin

Re: Where can I find a lexical spec of python?

2011-09-21 Thread Thomas Jollans
On 21/09/11 18:33, 程劭非 wrote: > Thanks Thomas. > I've read the document > http://docs.python.org/py3k/reference/lexical_analysis.html > > but I worried it might leak some language features like "tab magic". > > For I'm working on a parser with JavaScript I need a more strictly defined > spec.

Re:Re: Where can I find a lexical spec of python?

2011-09-21 Thread 程劭非
Thanks Thomas. I've read the document http://docs.python.org/py3k/reference/lexical_analysis.html but I worried it might leak some language features like "tab magic". For I'm working on a parser with JavaScript I need a more strictly defined spec. Currently I have a highlighter here ->http:

Re: Graphing

2011-09-21 Thread Grant Edwards
On 2011-09-21, Frank Ruiz wrote: > I am looking to plot some data points related to system metrics. > Benchmarking, etc. Can someone give some recommendations on a good > way to graph these datapoints in python. I started looking into > matplotlib, however was interested in others experiences. I

Re: Graphing

2011-09-21 Thread Peter Pearson
On Wed, 21 Sep 2011 08:44:13 -0700, Frank Ruiz wrote: > I am looking to plot some data points related to system metrics. > Benchmarking, etc. Can someone give some recommendations on a good way > to graph these datapoints in python. I started looking into > matplotlib, however was interested in ot

Graphing

2011-09-21 Thread Frank Ruiz
I am looking to plot some data points related to system metrics. Benchmarking, etc. Can someone give some recommendations on a good way to graph these datapoints in python. I started looking into matplotlib, however was interested in others experiences. -- http://mail.python.org/mailman/listinfo/p

Wing IDE 4.0.4 released

2011-09-21 Thread Wingware
Hi, Wingware has released version 4.0.4 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tip

Re: Where can I find a lexical spec of python?

2011-09-21 Thread Thomas Jollans
On 21/09/11 11:44, 程劭非 wrote: > Hi, everyone, > I've found there was several tokens used in python's > grammar(http://docs.python.org/reference/grammar.html) but I didn't see > their definition anywhere. The tokens listed here: They should be documented in http://docs.python.org/py3k/reference/

Where can I find a lexical spec of python?

2011-09-21 Thread 程劭非
Hi, everyone, I've found there was several tokens used in python's grammar(http://docs.python.org/reference/grammar.html) but I didn't see their definition anywhere. The tokens listed here: NEWLINE ENDMARKER NAME INDENT DEDENT NUMBER STRING I've got some infomations from the source code(htt

Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-21 Thread Antoon Pardon
On Wed, Sep 21, 2011 at 07:41:50AM +0200, Martin v. Loewis wrote: > > Is it just that nobody's implemented it, or is there a good reason for > > avoiding offering this sort of thing? > > I've been considering to implement killing threads several times for the > last 15 years (I think about it once

Tunneling using paramiko to establish tunnel with lab-router

2011-09-21 Thread Vinay
Hello Friends, I am looking to implement tunneling in python and using "Paramiko" for this.. Sending theTunneling script using Paramiko -Python. It's facing some prob, hangs on running the script..output message it says ".. Missing Handlers". Plz let me know the corrections to be done in t