Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread vince spicer
On Wed, Oct 21, 2009 at 3:56 PM, Jason Willis wrote: > so i changed the .bashrc and added at the end : > PATH="/home/compy/pythons:$PATH" ###which is the actual path to my python > proggies### > > and i still get > co...@compy-laptop:~/pythons$ herosinventory.py > herosinventory.py: command not f

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Skipper Seabold
On Wed, Oct 21, 2009 at 5:56 PM, Jason Willis wrote: > so i changed the .bashrc and added at the end : > PATH="/home/compy/pythons:$PATH"  ###which is the actual path to my python > proggies### > > and i still get > co...@compy-laptop:~/pythons$ herosinventory.py > herosinventory.py: command not f

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Luke Paireepinart
On Wed, Oct 21, 2009 at 5:12 PM, Luke Paireepinart wrote: > > > On Wed, Oct 21, 2009 at 4:56 PM, Jason Willis wrote: > >> so i changed the .bashrc and added at the end : >> PATH="/home/compy/pythons:$PATH" ###which is the actual path to my python >> proggies### > > No, you have to set the environ

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Luke Paireepinart
On Wed, Oct 21, 2009 at 4:56 PM, Jason Willis wrote: > so i changed the .bashrc and added at the end : > PATH="/home/compy/pythons:$PATH" ###which is the actual path to my python > proggies### No, you have to set the environment variable from within the path, not modifying .bashrc. $PATH refers

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Jason Willis
so i changed the .bashrc and added at the end : PATH="/home/compy/pythons:$PATH" ###which is the actual path to my python proggies### and i still get co...@compy-laptop:~/pythons$ herosinventory.py herosinventory.py: command not found co...@compy-laptop:~/pythons$ herosinventory.py herosinventory

Re: [Tutor] ifdef in python

2009-10-21 Thread Wayne
On Wed, Oct 21, 2009 at 3:29 PM, Lie Ryan wrote: > Lizhi Yang wrote: > >> Is there anything similar to ifdef statement in C or C++ in python? >> > > Not really, but python's regular if can be used for a similar purpose: > > DEBUG = True > > if DEBUG: >import logging >def foo(): >#

Re: [Tutor] ifdef in python

2009-10-21 Thread Lie Ryan
Lizhi Yang wrote: Is there anything similar to ifdef statement in C or C++ in python? Not really, but python's regular if can be used for a similar purpose: DEBUG = True if DEBUG: import logging def foo(): # debug version else: def foo(): # normal version def main

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Lie Ryan
Jason Willis wrote: hi everyone, sorry for the rather boring question but i'm having serious issues getting my programs to run from the command line without having to type "python" in-front of them. I've tried a lot of different variations on the #!/usr/bin/ etc. line and have come up with th

Re: [Tutor] ifdef in python

2009-10-21 Thread Kent Johnson
On Wed, Oct 21, 2009 at 3:26 PM, Lizhi Yang wrote: > Is there anything similar to ifdef statement in C or C++ in python? No, Python doesn't have a preprocessor. Can you say why you want it? You may be able to do what you want using an ordinary if statement, for example you can conditionally impor

[Tutor] ifdef in python

2009-10-21 Thread Lizhi Yang
Is there anything similar to ifdef statement in C or C++ in python? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Detect duplicate object names

2009-10-21 Thread Kent Johnson
On Wed, Oct 21, 2009 at 2:09 PM, Lizhi Yang wrote: > Hi, > > When I define functions in a Module, how to avoid override the name of > existing functions? > For example: > > define func1(): > define func2(): > define func1(): > > Is there anyway to pop up the warnings? Take a look at PyFlakes and

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread vince spicer
On Wed, Oct 21, 2009 at 12:33 PM, vince spicer wrote: > > > On Wed, Oct 21, 2009 at 12:31 PM, vince spicer wrote: > >> >> >> On Wed, Oct 21, 2009 at 12:21 PM, Jason Willis >> wrote: >> >>> hi everyone, >>> >>> sorry for the rather boring question but i'm having serious issues >>> getting my prog

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Steve Willoughby
On Wed, Oct 21, 2009 at 02:21:23PM -0400, Jason Willis wrote: > hi everyone, > > sorry for the rather boring question but i'm having serious issues getting > my programs to run from the command line without having to type "python" > in-front of them. I've tried a lot of different variations on the

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Eric L. Howard
The directory you are sitting in doesn't appear to be in your path... [ehow...@preacher ~/bin]$ ls macosver macosver* [ehow...@preacher ~/bin]$ macosver 10.5.8 [ehow...@preacher ~/bin]$ echo $PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:~/bin:/opt/local/bin:/opt/local/sbin ~elh On Wed, Oct

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread vince spicer
On Wed, Oct 21, 2009 at 12:31 PM, vince spicer wrote: > > > On Wed, Oct 21, 2009 at 12:21 PM, Jason Willis > wrote: > >> hi everyone, >> >> sorry for the rather boring question but i'm having serious issues getting >> my programs to run from the command line without having to type "python" >> in

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Amos Anderson
Are you by chance editing the file in Windows? Have you verified that python is in /usr/bin? In some cases it could be in a different location. On Wed, Oct 21, 2009 at 1:21 PM, Jason Willis wrote: > hi everyone, > > sorry for the rather boring question but i'm having serious issues getting > my p

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread vince spicer
On Wed, Oct 21, 2009 at 12:21 PM, Jason Willis wrote: > hi everyone, > > sorry for the rather boring question but i'm having serious issues getting > my programs to run from the command line without having to type "python" > in-front of them. I've tried a lot of different variations on the > #!/us

[Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Jason Willis
hi everyone, sorry for the rather boring question but i'm having serious issues getting my programs to run from the command line without having to type "python" in-front of them. I've tried a lot of different variations on the #!/usr/bin/ etc. line and have come up with the following every time:

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Kent Johnson
Forwarding to the list with my reply... On Wed, Oct 21, 2009 at 1:21 PM, Chris Fuller wrote: > > There are workarounds.  The point is that they aren't necessary in Linux, and > usually involve something fishy, like sleeping a (more or less) arbitrary > period to get the synchronization right, whi

[Tutor] Detect duplicate object names

2009-10-21 Thread Lizhi Yang
Hi, When I define functions in a Module, how to avoid override the name of existing functions? For example: define func1(): define func2(): define func1(): Is there anyway to pop up the warnings? ___ Tutor maillist - Tutor@python.org To unsubscribe o

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Kent Johnson
On Wed, Oct 21, 2009 at 10:43 AM, Chris Fuller wrote: > > on differences: > > The downloads include binaries, so there have to be distinct files for Linux > and Windoze.  If you download the same versions, there shouldn't be any > noticeable differences, with one big exception:  multithreading and

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Ken Oliver
-Original Message- >From: Chris Fuller >Sent: Oct 21, 2009 10:43 AM >To: tutor@python.org >Subject: Re: [Tutor] PyGTK: is there a library for both Linux and Windows > > >on differences: > >The downloads include binaries, so there have to be distinct files for Linux >and Windoze. If you

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Chris Fuller
on differences: The downloads include binaries, so there have to be distinct files for Linux and Windoze. If you download the same versions, there shouldn't be any noticeable differences, with one big exception: multithreading and PyGTK don't mix well on Windows. Your application might run

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Chris Fuller
The version of GTK for windows I like to use is at http://gladewin32.sourceforge.net/, but it is rather out of date. It's main advantage is everything is bundled up in a nice installer. You can also get it from the main site at ftp://ftp.gtk.org/pub/gtk, but you have to grab several files an

Re: [Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Wayne
On Wed, Oct 21, 2009 at 8:42 AM, Nicola De Quattro < lead.express...@gmail.com> wrote: > Hi > I'm starting to design some windows for my little tool. > I've two questions for you: > 1) In this page http://www.pygtk.org/downloads.html there are two > different library for Windows and GNU/Linux, but

[Tutor] PyGTK: is there a library for both Linux and Windows

2009-10-21 Thread Nicola De Quattro
Hi I'm starting to design some windows for my little tool. I've two questions for you: 1) In this page http://www.pygtk.org/downloads.html there are two different library for Windows and GNU/Linux, but I want my application to be executed identically under Windows and under GNU/Linux. Is PyGTK a go

Re: [Tutor] Python List Help

2009-10-21 Thread Lie Ryan
Mike Sweany wrote: 33 print len(playerid) 34 print playerid[0] 35 *playerid* = [] **: list index out of range args = ('list index out of range',) message = 'list index out of range' If I change the print playerid[0] to print playerid[1], same er

Re: [Tutor] New to Python

2009-10-21 Thread Wayne
On Tue, Oct 20, 2009 at 4:55 PM, wrote: > Hello all, > Just started looking at Python, I have not programmed in a good 8-10 years > now, and find myself woefully behind. > Luckily it shouldn't take you too much time with python - it's a lot easier to learn/relearn than a lot of other languages!

Re: [Tutor] "if clause" in list comprehensions.

2009-10-21 Thread Kent Johnson
On Wed, Oct 21, 2009 at 3:30 AM, Albert-Jan Roskam wrote: > Is the if-else (esp. 'else') in a list comprehension specific for Python 3.x? > Or did I miss something? List comps have always allowed a condition since they were introduced: [ for in if ] This is the form of the original questi

Re: [Tutor] New to Python

2009-10-21 Thread Alan Gauld
wrote Just started looking at Python Welcome to the list. I was wondering if there was a Preset Menu and file system module Not really sure what you are expecting here? Can you give examples of what you would expect these to do? There are operations for acting on files, if thats what you

Re: [Tutor] "if clause" in list comprehensions.

2009-10-21 Thread ALAN GAULD
> Is the if-else (esp. 'else') in a list comprehension specific for Python 3.x? > Or > did I miss something? Its not part of list comprehensions per se, you can use it in any *expression*. It was introduced in Python 2.5 as a response to C's ternary operator: C: x = foo?bar:baz Python x =

Re: [Tutor] "if clause" in list comprehensions.

2009-10-21 Thread Christian Witts
Albert-Jan Roskam wrote: Is the if-else (esp. 'else') in a list comprehension specific for Python 3.x? Or did I miss something? Cheers!! Albert-Jan ~~ Before you criticize someone, walk a mile in their shoes, that way when yo

Re: [Tutor] "if clause" in list comprehensions.

2009-10-21 Thread Albert-Jan Roskam
Is the if-else (esp. 'else') in a list comprehension specific for Python 3.x? Or did I miss something? Cheers!! Albert-Jan ~~ Before you criticize someone, walk a mile in their shoes, that way when you do criticize them, you're