Re: os.system and subprocess odd behavior

2012-12-18 Thread Cameron Simpson
On 18Dec2012 05:39, Dave Angel wrote: | On 12/18/2012 05:27 AM, Hans Mulder wrote: | > On 18/12/12 06:10:43, photonym...@gmail.com wrote: | >> I hope I understand the question... but shouldn't you wait for the process to complete before exiting? | >> | >> Something like: | >> | >> pid = subproces

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 17/12/12 21:56:50, py_genetic wrote: > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB < > /home/myusr/jobs/APP_JOBS/JOB_XXX.SQL > /home/myusr/jobs/APP_JOBS/JOB_XXX.TXT If you're trying to interact with a MySQL database, then you should really

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Solved the issue, by injecting the query into the cmd line. Shell script worked fine as if I was cutting and pasting to the prompt. Seems to still be something with the subprocess receiving and exit code before or when the query finishes, just when I ask to to read from the .SQL file. example

Re: os.system and subprocess odd behavior

2012-12-18 Thread Oscar Benjamin
Can you trim content and interleave your response (instead of top-posting) please? On 18 December 2012 18:26, py_genetic wrote: > HOWEVER... > > when using this command from before no dice > > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB <

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Oscar I can confirm this behavior from terminal. AND this works as well, simulating exactly what I'm doing permissions wise, and calling sudo python test.py below f1 = open('TESTDIR/file1.txt', 'w') f1.write('some test here\n') f1.close() cmd1 = 'cat < TESTDIR/file1.txt > TESTDIR/file2.txt' P

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 11:39:56, Dave Angel wrote: > On 12/18/2012 05:27 AM, Hans Mulder wrote: >> On 18/12/12 06:10:43, photonym...@gmail.com wrote: >>> I hope I understand the question... but shouldn't you wait for the process >>> to complete before exiting? >>> >>> Something like: >>> >>> pid = subprocess

Re: os.system and subprocess odd behavior

2012-12-18 Thread Dave Angel
On 12/18/2012 05:27 AM, Hans Mulder wrote: > On 18/12/12 06:10:43, photonym...@gmail.com wrote: >> I hope I understand the question... but shouldn't you wait for the process >> to complete before exiting? >> >> Something like: >> >> pid = subprocess.Popen(...) >> pid.wait() >> >> Otherwise, it'll

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 06:10:43, photonym...@gmail.com wrote: > I hope I understand the question... but shouldn't you wait for the process to > complete before exiting? > > Something like: > > pid = subprocess.Popen(...) > pid.wait() > > Otherwise, it'll exit before the background process is done. Why w

Re: os.system and subprocess odd behavior

2012-12-17 Thread photonymous
I hope I understand the question... but shouldn't you wait for the process to complete before exiting? Something like: pid = subprocess.Popen(...) pid.wait() Otherwise, it'll exit before the background process is done. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 20:56, py_genetic wrote: > Oscar, seems you may be correct. I need to run this program as a superuser. > However, after some more tests with simple commands... I seem to be working > correctly from any permission level in python Except for the output write > command f

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Oscar, seems you may be correct. I need to run this program as a superuser. However, after some more tests with simple commands... I seem to be working correctly from any permission level in python Except for the output write command from the database to a file. Which runs fine if I past

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 16:39, py_genetic wrote: > Thanks for verifying this for me Steven. I'm glad you are seeing it work. > It's really the strangest thing. > > The issue seems to be with the " > outfile.txt" portion of the command. > > The actual command is running a query on a verticalDB and d

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks for verifying this for me Steven. I'm glad you are seeing it work. It's really the strangest thing. The issue seems to be with the " > outfile.txt" portion of the command. The actual command is running a query on a verticalDB and dumping the result. The EXACT command run from the comm

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks! I am using .txt extensions. Sorry for being a little vague. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and subprocess odd behavior

2012-12-14 Thread Dieter Maurer
py_genetic writes: > Example of the issue for arguments sake: > > Platform Ubuntu server 12.04LTS, python 2.7 > > Say file1.txt has "hello world" in it. ^ Here, you speak of "file1.txt" (note the extension ".txt") > subprocess.Popen("cat < file1 > file2", shell = True) > subprocess

Re: os.system and subprocess odd behavior

2012-12-14 Thread Steven D'Aprano
On Fri, 14 Dec 2012 10:13:38 -0800, py_genetic wrote: > Example of the issue for arguments sake: > > Platform Ubuntu server 12.04LTS, python 2.7 > > Say file1.txt has "hello world" in it. > > subprocess.Popen("cat < file1 > file2", shell = True) > subprocess.call("cat < file1 > file2", shell =

os.system and subprocess odd behavior

2012-12-14 Thread py_genetic
Example of the issue for arguments sake: Platform Ubuntu server 12.04LTS, python 2.7 Say file1.txt has "hello world" in it. subprocess.Popen("cat < file1 > file2", shell = True) subprocess.call("cat < file1 > file2", shell = True) os.system("cat < file1 > file2") I'm finding that file2 IS crea

Re: Odd behavior of object equality/identity in the context of relative vs fully qualified imports

2011-12-15 Thread Peter Otten
Nathan Rice wrote: > I just ran into this yesterday, and I am curious if there is a > rational behind it... > > I have a class that uses a dictionary to dispatch from other classes > (k) to functions for those classes (v). I recently ran into a bug > where the dictionary would report that a clas

Re: Odd behavior of object equality/identity in the context of relative vs fully qualified imports

2011-12-15 Thread Ian Kelly
On Thu, Dec 15, 2011 at 7:34 AM, Nathan Rice wrote: > I just ran into this yesterday, and I am curious if there is a > rational behind it... > > I have a class that uses a dictionary to dispatch from other classes > (k) to functions for those classes (v).  I recently ran into a bug > where the dic

Re: Odd behavior of object equality/identity in the context of relative vs fully qualified imports

2011-12-15 Thread Nathan Rice
It would be more work than I want to go into to provide full context (unless it is to file a bug report, if it actually is a bug). I verified that there are no cyclical dependency issues using snakefood, and I doublechecked that just changing the import from full to partial name is sufficient to r

Re: Odd behavior of object equality/identity in the context of relative vs fully qualified imports

2011-12-15 Thread Dave Angel
On 12/15/2011 09:34 AM, Nathan Rice wrote: I just ran into this yesterday, and I am curious if there is a rational behind it... I have a class that uses a dictionary to dispatch from other classes (k) to functions for those classes (v). I recently ran into a bug where the dictionary would repor

Odd behavior of object equality/identity in the context of relative vs fully qualified imports

2011-12-15 Thread Nathan Rice
I just ran into this yesterday, and I am curious if there is a rational behind it... I have a class that uses a dictionary to dispatch from other classes (k) to functions for those classes (v). I recently ran into a bug where the dictionary would report that a class which was clearly in the dicti

Re: Odd behavior with imp.reload and logging

2011-09-23 Thread Andrew Berg
On 2011.09.22 03:12 AM, Chris Angelico wrote: > In theory, this should mean that you load it fresh every time - I > think. If not, manually deleting entries from sys.modules might help, > either with or without the list of modules. I've played around with sys.modules, and it seems there are issues

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Andrew Berg
On 2011.09.22 03:25 AM, Steven D'Aprano wrote: > Objects left lying around from before the reload will keep references > open to the way things were before the reload. This often leads to > confusion when modules are edited, then reloaded. (Been there, done that.) I'll keep that in mind. My modul

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Steven D'Aprano
On Wed, 21 Sep 2011 23:47:55 -0500, Andrew Berg wrote: > 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 Practically everything. A reload doesn't delete anything,

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Chris Angelico
On Thu, Sep 22, 2011 at 5:59 PM, Andrew Berg wrote: > That's quite unappealing for a few reasons. First, that would likely > require writing an entirely new bot (I'm not even that familiar with the > current one; I've only been writing a module for it). Ah, then yeah, it's probably not a good ide

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Andrew Berg
On 2011.09.22 01:46 AM, Chris Angelico wrote: > I think Pike may be a good choice for you. That's quite unappealing for a few reasons. First, that would likely require writing an entirely new bot (I'm not even that familiar with the current one; I've only been writing a module for it). Also, I don'

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: 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

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: 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: 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

Re: Python 2.6.3 TarFile Module Add odd behavior

2009-11-15 Thread Gabriel Genellina
En Fri, 13 Nov 2009 16:23:31 -0300, Tilson, Greg (IS) escribió: In Windows Python 2.6.3 calling TarFile.add requires arcname= to be set to work with WinZIP or WinRAR [...]If arcname= is not set during extraction all filenames are "None" Suggest document change or filing a bug report Pos

Python 2.6.3 TarFile Module Add odd behavior

2009-11-13 Thread Tilson, Greg (IS)
In Windows Python 2.6.3 calling TarFile.add requires arcname= to be set to work with WinZIP or WinRAR Documentation reads: TarFile.add(name, arcname=None, recursive=True, exclude=None) Add the file name to the archive. name may be any type of file (directory, fifo, symbolic link, etc.). If given

Re: Odd behavior regarding a list

2009-03-26 Thread Rhodri James
On Thu, 26 Mar 2009 17:01:40 -, Edd Barrett wrote: On Mar 26, 4:21 pm, Steven D'Aprano wrote: A few more comments, based on your code. >    def __classdef_integer(self): Double-underscore name mangling is often more trouble than it is worth. Unless you really need it, not just think you

Re: Odd behavior regarding a list

2009-03-26 Thread Edd Barrett
Hi there, First of all, thanks to everyone for replying. This has been a great help. On Mar 26, 4:21 pm, Steven D'Aprano wrote: > On Thu, 26 Mar 2009 08:36:49 -0700, Edd Barrett wrote: > > My question is: why has 'parent_struct_sig' changed? I was under the > > impression the assignment operator

Re: Odd behavior regarding a list

2009-03-26 Thread Steven D'Aprano
On Thu, 26 Mar 2009 08:36:49 -0700, Edd Barrett wrote: > Hi there, > > My first post here, so hello :) Hello and welcome. Let me comment on a few things out of order. > My question is: why has 'parent_struct_sig' changed? I was under the > impression the assignment operator copies, not referen

Re: Odd behavior regarding a list

2009-03-26 Thread Dave Angel
But you didn't do an assignment, you did an append. Append modifies the object, which is referenced by both parent_struct_sig and this_cdata["struct-sig"] If you're sure you want a *copy* of the list before the modifications, you might do something like parent_struct_sig = \

Re: Odd behavior regarding a list

2009-03-26 Thread Albert Hopkins
On Thu, 2009-03-26 at 08:36 -0700, Edd Barrett wrote: > Hi there, > > My first post here, so hello :) > > Just a little background, I am writing my dissertation, which is a JIT > compiler based upon LLVM and it's python bindings, along with the > aperiot LL(1) parser. > > I have some code here,

Odd behavior regarding a list

2009-03-26 Thread Edd Barrett
Hi there, My first post here, so hello :) Just a little background, I am writing my dissertation, which is a JIT compiler based upon LLVM and it's python bindings, along with the aperiot LL(1) parser. I have some code here, which is not behaving as I would expect. Could someone enlighten me as t

Re: Odd behavior of python module listing

2008-06-09 Thread Benjamin Kaplan
On Mon, Jun 9, 2008 at 4:58 PM, Lie <[EMAIL PROTECTED]> wrote: > Yesterday I installed compiz-icon in my Ubuntu. Today, when I go to > the python interpreter, I happen to do this: > > ### START OF PYTHON SESSION ### > Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubu

Odd behavior of python module listing

2008-06-09 Thread Lie
Yesterday I installed compiz-icon in my Ubuntu. Today, when I go to the python interpreter, I happen to do this: ### START OF PYTHON SESSION ### Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more

Re: Win32 python: odd behavior when run via ssh

2008-02-02 Thread Thorsten Kampe
* Gabriel Genellina (Fri, 01 Feb 2008 23:13:27 -0200) > En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge > <[EMAIL PROTECTED]> escribió: > > If you're using the offficial Win32 port of Python than you > > probably want to use the Cygwin version because Win32 version > > doesn't support readline any

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Gabriel Genellina
En Sat, 02 Feb 2008 01:40:50 -0200, Steve Holden <[EMAIL PROTECTED]> escribi�: > Gabriel Genellina wrote: >> I don't understand the comment. Most of the readline functionality is >> already present on Windows XP (command history, up/down arrows, edit >> [...] > Until you try to do something li

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Steve Holden
Gabriel Genellina wrote: > En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge > <[EMAIL PROTECTED]> escribió: > >> If you're using the offficial Win32 port of Python than you probably >> want to use the Cygwin version because Win32 version doesn't support >> readline anyways. > > I don't understand

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Grant Edwards
On 2008-02-02, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge ><[EMAIL PROTECTED]> escribió: > >> If you're using the offficial Win32 port of Python than you >> probably want to use the Cygwin version because Win32 version >> doesn't support readline

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Martin v. Löwis
> That's odd, because readline seems to work fine in a Windows > console (recalling previous lines and line editing). That's an illusion. The Windows version of Python does not support or use GNU readline at all. What you see is a feature of the console window. Regards, Martin -- http://mail.pyt

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Gabriel Genellina
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge <[EMAIL PROTECTED]> escribió: > If you're using the offficial Win32 port of Python than you probably > want to use the Cygwin version because Win32 version doesn't support > readline anyways. I don't understand the comment. Most of the readline fun

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Grant Edwards
On 2008-02-02, Ross Ridge <[EMAIL PROTECTED]> wrote: >>When I ssh into a windows machine (running Cygwin sshd), I can >>invoke python at the shell prompt (you have to use -i option >>and I don't really understand why). >> >>Once it's started there are couple rather odd behaviors: >> >> 1) readline

Re: Win32 python: odd behavior when run via ssh

2008-02-01 Thread Ross Ridge
Grant Edwards <[EMAIL PROTECTED]> wrote: >When I ssh into a windows machine (running Cygwin sshd), I can >invoke python at the shell prompt (you have to use -i option >and I don't really understand why). > >Once it's started there are couple rather odd behaviors: > > 1) readline support doesn't wo

Win32 python: odd behavior when run via ssh

2008-02-01 Thread Grant Edwards
When I ssh into a windows machine (running Cygwin sshd), I can invoke python at the shell prompt (you have to use -i option and I don't really understand why). Once it's started there are couple rather odd behaviors: 1) readline support doesn't work. 2) you have call sys.exit() to exit (neithe

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
On Dec 22, 7:35 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > But an expression (e.g. string) is NOT a variable. > > in this case, it is.  I don't know if it's worth spending more time on > this, since you're not listening, but let's make one more attempt. Sure I'm listening (well,

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Fredrik Lundh
Lie wrote: > But an expression (e.g. string) is NOT a variable. in this case, it is. I don't know if it's worth spending more time on this, since you're not listening, but let's make one more attempt. for the Entry widget, the "textvariable" argument, if given, identifies an *internal* Tkint

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
> But an expression (e.g. string) is NOT a variable. It's fine if the > value mirrored when I set the textvariable conf to the same variable, > but in this case I'm setting them to the same expression (e.g. string). On the other hand, the oddness multiplied since the value replication doesn't happ

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
On Dec 22, 1:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > >>> Inspect the following code: > > >>> --- start of code --- > >>> import Tkinter as Tk > >>> from Tkconstants import * > >>> root = Tk.Tk() > >>> e1 = Tk.Entry(root, text = 'Hello World') > >>> e2 = Tk.Entry(root, text =

Re: Odd behavior in Python/Tkinter?

2007-12-21 Thread Fredrik Lundh
Lie wrote: >>> Inspect the following code: >>> >>> --- start of code --- >>> import Tkinter as Tk >>> from Tkconstants import * >>> root = Tk.Tk() >>> e1 = Tk.Entry(root, text = 'Hello World') >>> e2 = Tk.Entry(root, text = 'Hello World') >> >> the "text" (or "textvariable") option to the Entry

Re: Odd behavior in Python/Tkinter?

2007-12-21 Thread Lie
On Dec 22, 4:05 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > Inspect the following code: > > > --- start of code --- > > import Tkinter as Tk > > from Tkconstants import * > > > root = Tk.Tk() > > > e1 = Tk.Entry(root, text = 'Hello World') > > e2 = Tk.Entry(root, text = 'Hello Wor

Re: Odd behavior in Python/Tkinter?

2007-12-21 Thread Simon Forman
On Dec 21, 12:30 pm, Lie <[EMAIL PROTECTED]> wrote: > Inspect the following code: > > --- start of code --- > import Tkinter as Tk > from Tkconstants import * > > root = Tk.Tk() > > e1 = Tk.Entry(root, text = 'Hello World') > e2 = Tk.Entry(root, text = 'Hello World') > > e1.grid(row = 1, column = 1

Re: Odd behavior in Python/Tkinter?

2007-12-21 Thread Fredrik Lundh
Lie wrote: > Inspect the following code: > > --- start of code --- > import Tkinter as Tk > from Tkconstants import * > > root = Tk.Tk() > > e1 = Tk.Entry(root, text = 'Hello World') > e2 = Tk.Entry(root, text = 'Hello World') the "text" (or "textvariable") option to the Entry widget is the na

Odd behavior in Python/Tkinter?

2007-12-21 Thread Lie
Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello World') e1.grid(row = 1, column = 1) e2.grid(row = 2, column = 1) e1.insert(END, 'Hello Python') root.mai

Re: Odd behavior with staticmethods

2006-07-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: please stop top-posting, it's getting very annoying > ya know, I've searched for these "new classes" at least five times. Then go and buy yourself a pair of glasses. It's one of the entrie in the "documentation" menu of python.org. -- bruno desthuilliers python -c "pri

Re: Odd behavior with staticmethods

2006-07-02 Thread [EMAIL PROTECTED]
THANK YOU! Now I can actually worry about the advantages/disadvantages! -- http://mail.python.org/mailman/listinfo/python-list

Re: Odd behavior with staticmethods

2006-07-01 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > ya know, I've searched for these "new classes" at least five times. > I've heard all the wonderful things about how they make your life into > a piece of chocolate with rainbows sprinkled in it. Never once have I > found a site that explains what syntax to use to make th

Re: Odd behavior with staticmethods

2006-07-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > ya know, I've searched for these "new classes" at least five times. > I've heard all the wonderful things about how they make your life into > a piece of chocolate with rainbows sprinkled in it. Never once have I > found a site that explains what syntax to use to make

Re: Odd behavior with staticmethods

2006-07-01 Thread [EMAIL PROTECTED]
ya know, I've searched for these "new classes" at least five times. I've heard all the wonderful things about how they make your life into a piece of chocolate with rainbows sprinkled in it. Never once have I found a site that explains what syntax to use to make these new classes. Anyone have a U

Re: Odd behavior with staticmethods

2006-07-01 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I'm getting rather inconsistent behavior with staticmethod. Not really. class A: > def orig(): > print "hi" > st = staticmethod(orig) > st2 = st > wrapped = [ orig ] > wrapped2 = [ st ] ... A.wrapped[0]() # ODD - wra

Odd behavior with staticmethods

2006-07-01 Thread [EMAIL PROTECTED]
I'm getting rather inconsistent behavior with staticmethod. @staticmethod has the same problems, but I'm demonstrating it with staticmethod() because it shows things more clearly --- >>> class A: def orig(): print "hi"

Re: odd behavior

2005-11-11 Thread Steven D'Aprano
On Fri, 11 Nov 2005 11:34:47 -0800, Greg wrote: > Forgive me, and be kind, as I am just a newby learning this language > out of M.L. Hetland's book. The following behavior of 2.4.1 seems very > strange x = ['aardvark', 'abalone', 'acme', 'add', 'aerate'] x.sort(key=len) x > ['add'

Re: odd behavior

2005-11-11 Thread Lee Harr
On 2005-11-11, Kristian Zoerhoff <[EMAIL PROTECTED]> wrote: > On 11 Nov 2005 11:34:47 -0800, Greg <[EMAIL PROTECTED]> wrote: >> Forgive me, and be kind, as I am just a newby learning this language >> out of M.L. Hetland's book. The following behavior of 2.4.1 seems very >> strange >> >>> x = ['aar

Re: odd behavior

2005-11-11 Thread Kristian Zoerhoff
On 11 Nov 2005 11:34:47 -0800, Greg <[EMAIL PROTECTED]> wrote: > Forgive me, and be kind, as I am just a newby learning this language > out of M.L. Hetland's book. The following behavior of 2.4.1 seems very > strange > >>> x = ['aardvark', 'abalone', 'acme', 'add', > 'aerate'] > >>> x.sort(ke

odd behavior

2005-11-11 Thread Greg
Forgive me, and be kind, as I am just a newby learning this language out of M.L. Hetland's book. The following behavior of 2.4.1 seems very strange >>> x = ['aardvark', 'abalone', 'acme', 'add', 'aerate'] >>> x.sort(key=len) >>> x ['add', 'acme', 'aerate', 'abalone', 'aardvark'] >>> x.sort(re

Re: Odd behavior with os.fork and time.sleep

2005-09-16 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Yin" <[EMAIL PROTECTED]> wrote: > I am writing a script that monitors a child process. If the child > process dies on its own, then the parent continues on. If the child > process is still alive after a timeout period, the parent will kill the > child process. E

Odd behavior with os.fork and time.sleep

2005-09-16 Thread Yin
I am writing a script that monitors a child process. If the child process dies on its own, then the parent continues on. If the child process is still alive after a timeout period, the parent will kill the child process. Enclosed is a snippet of the code I have written. For some reason, unless

Re: Printing w/o newlines inside loops - odd behavior

2005-09-13 Thread Jeffrey E. Forcier
Erik: Thanks, that was it! Figured it was something along those lines, but like I said, I didn't know specifically what was going on or what to look for. Larry: That recipe could be useful, thanks a lot :) And thanks for the quick replies, too, you guys are awesome. Regards, Jeff -- http://ma

Re: Printing w/o newlines inside loops - odd behavior

2005-09-13 Thread Larry Bates
Take a look at this recipe which is part of the latest Python Cookbook. I think it will help you. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 Larry Bates Jeffrey E. Forcier wrote: > This is a difficult issue to search for, and Googling (and reviewing > the pertinent Python do

Re: Printing w/o newlines inside loops - odd behavior

2005-09-13 Thread Erik Max Francis
Jeffrey E. Forcier wrote: > Doing multiple print statements inside a for loop, using the 'comma at > the end eats the newline' variant, results in zero output until the > loop completes its entire iteration. sys.stdout is line buffered. Put an intervening sys.stdout.flush() in between your prin

Printing w/o newlines inside loops - odd behavior

2005-09-13 Thread Jeffrey E. Forcier
This is a difficult issue to search for, and Googling (and reviewing the pertinent Python docs) has not found me anything useful. It's also not a super important issue, but regardless of whether it's avoidable, I still want to know what the heck is going on. Doing multiple print statements inside