Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread bob gailer
This thread got started due to the DIV15 problem on the Sphere Online Judge. This is almost a "black box" test environment. Submit a program. If it generates the expected output you get "accepted". The other results are " compilation error", "time limit exceeded", " runtime error (followed by (

[Tutor] new on the list

2008-02-27 Thread tonytraductor
Hi, I'm Tony. I'm a translator. This is my first post to this list. I've been using Linux, pretty well exclusively, for about 8 years, but I never got under the hood more than learning the shell basics to do basic stuff that I needed to do, manipulating config files. (Although I did recently mak

Re: [Tutor] Python oddity

2008-02-27 Thread Jeff Younker
So the problem is that when I change bb, aa also changes even though I don't want it to. Is this supposed to happen? Yes Names are handles for objects. Assignment binds a name to an object. The same object can be bound simultaneously to many names. Python distinguishes between equality an

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
Thanks to everyone for the help. My coworker seems to really prefer doing it via some system call. She seems to think it's possible quickly with csplit, which I've never used. I'll be investigating it in the morning, because she's really good at what she does. :) /alex On Wed, Feb 27, 2008 at 6:

Re: [Tutor] Python oddity

2008-02-27 Thread jim stockford
i'm guessing this is the "post-it effect". aa = range(0,10) print aa [0,1,2,3,4,5,6,7,8,9] # what you've done is to use the range function to # create the list of 0 to 9, then you associated the # name aa to the list. a popular teaching analogy # is that of putting a post-it that says aa on the l

Re: [Tutor] Python oddity

2008-02-27 Thread Terry Carroll
On Wed, 27 Feb 2008, Keith Suda-Cederquist wrote: > Hi, > > I'm using iPython and I've run into an occasional problem that I don't > understand. Here is what I'm seeing: > > >>aa=range(0,10) > >>bb=aa > >>print aa > [0,1,2,3,4,5,6,7,8,9] > >>print bb > [0,1,2,3,4,5,6,7,8,9] > >> # okay, everyth

Re: [Tutor] Python oddity

2008-02-27 Thread Tiger12506
Python lists are mutable. All mutable objects will behave in the fashion you described, whereas immutable objects -- tuples, integer, floats, etc. -- will behave in the fashion that you expect. This is because python keeps references to objects. When you say bb = aa, you are really saying, "Ta

Re: [Tutor] Python oddity

2008-02-27 Thread Luke Paireepinart
Keith Suda-Cederquist wrote: > Hi, > > I'm using iPython and I've run into an occasional problem that I don't > understand. Here is what I'm seeing: > > >>aa=range(0,10) > >>bb=aa > >>print aa > [0,1,2,3,4,5,6,7,8,9] > >>print bb > [0,1,2,3,4,5,6,7,8,9] > >> # okay, everything allright at this po

[Tutor] Python oddity

2008-02-27 Thread Keith Suda-Cederquist
Hi, I'm using iPython and I've run into an occasional problem that I don't understand. Here is what I'm seeing: >>aa=range(0,10) >>bb=aa >>print aa [0,1,2,3,4,5,6,7,8,9] >>print bb [0,1,2,3,4,5,6,7,8,9] >> # okay, everything allright at this point >>bb[5]=0 #change bb >>print aa [0,1,2,3,4,0,6

Re: [Tutor] SSH with Python

2008-02-27 Thread Jeff Younker
> What's the path to ssh under windows vista? Paramiko is a pure > python implementation of the SSH protocol, so it should run on any > platform. Paramiko rocks. I have a deployment system that works on linux, osx, and windows without a hitch. If you're writing a custom SSH server or doing

Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread Eric Brunson
Alan Gauld wrote: > "Eric Brunson" <[EMAIL PROTECTED]> wrote > >> Alan Gauld wrote: >> Glad we both noted the smileys. :-) > However, there is a bit of a serious point here too in that > users never ask for data validation (at least mine never do!) > they just expect it. So I still maint

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Tiger12506
This is bill's method written out in code which is the python you seek, young warrior! inname = 'inputfile' outname = 'outfile' infile = open(inname,'r') outfile = open(outname,'w') infile.readline() line = infile.readline() while line != "": outfile.write(line) infile.close() outfile.close()

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alan Gauld
"Alex Ezell" <[EMAIL PROTECTED]> wrote >> > What I need to do is to truncate the first line of a file which >> has an >> > unknown number of lines and an unknown size. > I might do something like this: > os.system("sed -i '1d' %s" % filename) > > I suspect it will be much faster on large file

Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread Alan Gauld
"Eric Brunson" <[EMAIL PROTECTED]> wrote > Alan Gauld wrote: > Which actually makes it a very good test since thats > exactly the kind of thing you should be testing for :-) Note the smiley... > A test suite that only checks valid data is a bad test. > > Testing for valid input seems to be outsi

Re: [Tutor] SSH with Python

2008-02-27 Thread Eric Walstad
Hey Eric, Eric Brunson wrote: > Eric Walstad wrote: >> Eric Brunson wrote: >> >> import pexpect ... >> child.sendline("nottherealpassword") ... >> > > What's the path to ssh under windows vista? I hope I never have to find out :) > Paramiko is a pure python > implementation of the SSH pro

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
On Wed, Feb 27, 2008 at 5:01 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Alex Ezell wrote: > > I must be missing some simple method on a file object or something. > > > > What I need to do is to truncate the first line of a file which has an > > unknown number of lines and an unknown size.

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Bill Campbell
On Wed, Feb 27, 2008, Alex Ezell wrote: >I must be missing some simple method on a file object or something. > >What I need to do is to truncate the first line of a file which has an >unknown number of lines and an unknown size. > >The only thing I can think to do is to readlines() and then slice o

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Kent Johnson
Alex Ezell wrote: > I must be missing some simple method on a file object or something. > > What I need to do is to truncate the first line of a file which has an > unknown number of lines and an unknown size. > > The only thing I can think to do is to readlines() and then slice off > the first l

[Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
I must be missing some simple method on a file object or something. What I need to do is to truncate the first line of a file which has an unknown number of lines and an unknown size. The only thing I can think to do is to readlines() and then slice off the first line in the resulting list, then

Re: [Tutor] SSH with Python

2008-02-27 Thread Eric Brunson
Eric Walstad wrote: Eric Brunson wrote: Tom wrote: I have a webfaction server (highly recommended btw) and I'm trying to use automate some tasks over ssh but I'm not having much luck with pyssh http://pyssh.sourceforge.net/ . Some of the docs mention methods that d

Re: [Tutor] SSH with Python

2008-02-27 Thread Eric Walstad
Eric Brunson wrote: > Tom wrote: >> I have a webfaction server (highly recommended btw) and I'm trying to >> use automate some tasks over ssh but I'm not having much luck with >> pyssh http://pyssh.sourceforge.net/ . >> >> Some of the docs mention methods that don't exist in the version I >> downlo

Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread Andrei Petre
i'm thinking the same way Eric do. On Wed, Feb 27, 2008 at 11:18 PM, Eric Brunson <[EMAIL PROTECTED]> wrote: > Alan Gauld wrote: > > "bob gailer" <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote > > > > i don't really understand that. you are trying to say that the > tests > from the online judge

Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread Eric Brunson
Alan Gauld wrote: "bob gailer" <[EMAIL PROTECTED]> wrote i don't really understand that. you are trying to say that the tests from the online judge are not "exactly good" ? Yes that's exactly what I'm saying. At least one test case has a non-decimal charact

[Tutor] Textures using Pygame

2008-02-27 Thread Julia
Hi everyone! I am currently working on a raycasting engine using pygame for graphics. The engine works great and now I'm thinking about adding support for textures. The problem is that I'm not really sure to with modules and methods to use. I need to be able to load textures, scale then to fit an

Re: [Tutor] SSH with Python

2008-02-27 Thread Eric Brunson
Tom wrote: > I have a webfaction server (highly recommended btw) and I'm trying to > use automate some tasks over ssh but I'm not having much luck with > pyssh http://pyssh.sourceforge.net/ . > > Some of the docs mention methods that don't exist in the version I > downloaded, such as pyssh.run. > >

[Tutor] SSH with Python

2008-02-27 Thread Tom
I have a webfaction server (highly recommended btw) and I'm trying to use automate some tasks over ssh but I'm not having much luck with pyssh http://pyssh.sourceforge.net/ . Some of the docs mention methods that don't exist in the version I downloaded, such as pyssh.run. I'm using windows vista

Re: [Tutor] rss feed reader, but having trouble with unicode

2008-02-27 Thread Tom
Finally got it working. I used your suggestion Rui, but I also had to change the charset encoding that my database was using. Changed from Latin-1 to UCS2. I read http://www.joelonsoftware.com/articles/Unicode.html too. Essential reading. Thanks. On 26/02/2008, rui <[EMAIL PROTECTED]> wrote: > H