Re: [Tutor] CGI File Woes

2007-09-29 Thread Eric Walker
The best way to debug cgi is to tail the server log when you don't get commandline output. This will give you a clue to what is happening.. shoulld be something like /var/log/apache or something like that... Eric wormwood_3 <[EMAIL PROTECTED]> wrote: Hello all, I am working on a very sim

[Tutor] CGI File Woes

2007-09-29 Thread wormwood_3
Hello all, I am working on a very simple CGI script. The site I want to use it on is a shared linux host, but I confirmed that .py files in the right dir with the right permissions and shebang execute just fine, Hello World sort of tests were successful. So now something a little more involved

Re: [Tutor] Learning Python (Ara Kooser)

2007-09-29 Thread Ara Kooser
Fred, I've been learning python off and on for a couple years now. I recommend: Alan Gauld's Learning to Program http://www.freenetpages.co.uk/hp/alan.gauld/ and How to Think Like a Computer Scientist http://www.ibiblio.org/obp/thinkCSpy/ Also find a project you are passionate about and try t

Re: [Tutor] linux terminal coloring in python

2007-09-29 Thread wormwood_3
Hello, I actually wanted/looked for colored output in the CLI for quite a while myself, and finally found the solution! The magic?: "echo -e". The syntax is a little odd to use it, and I don't think I can explain it very succinctly. It may be best to see an example of it in action. I wrote a ba

[Tutor] Disable keyboard/mouse input on windows?

2007-09-29 Thread Trey Keown
Hey everybody, I was wondering, how could I disable all keyboard/mouse input for the whole windows system while I have a video playing? So the user can't press, for example, the super key [one with windows logo on it], and have the windows menu pop up? Could this be accomplished somehow through sys

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread Alan Gauld
"James" <[EMAIL PROTECTED]> wrote > (a) If I open a terminal and then run my python script > (./script.py), > it fails giving me the RLock error I attached in my original e-mail. > (b) If I open a FRESH terminal, run the interpreter (python), import > threading & logging and then run the same e

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread Alan Gauld
"James" <[EMAIL PROTECTED]> wrote > I'm having some trouble using the Python logging module. Here's the > snippet of code that's causing problems: > > > > # setting up logging using Python's logging module > LOGFILE = "/home/james/log" > logging.basicConfig( level=logging.DEBUG, > forma

Re: [Tutor] Learning Python

2007-09-29 Thread Alan Gauld
"Fred P" <[EMAIL PROTECTED]> wrote > I am completely new at python, but not new to programming or > scripting. I have a couple of years of LUA scripting experience, > about a year of C++ classes, and used to be very efficient at > c-shell > scripting in unix. > > My question for you guys: > > 1

Re: [Tutor] strategy in dealing with user input

2007-09-29 Thread Alan Gauld
"Robert Jackson" <[EMAIL PROTECTED]> wrote >I have a few lines of code as follows: > > CONFIGFILE = raw_input("Enter config location: ") >while CONFIGFILE == "": > CONFIGFILE = raw_input("You must enter configuration file > location: ") All uppercasse is usually used to indicate a co

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread James
Wow this has gotten awfully strange. I'm running Python on OS X. Here's a quick rundown of what I just found: (a) If I open a terminal and then run my python script (./script.py), it fails giving me the RLock error I attached in my original e-mail. (b) If I open a FRESH terminal, run the in

Re: [Tutor] linux terminal coloring in python

2007-09-29 Thread Alan Gauld
"Robert Jackson" <[EMAIL PROTECTED]> wrote > I'm trying to get some pretty colored output for a Linux console > / terminal window. Google searches only reveal the curses module > to colorize output. curses means it will work for any console supporting color and curses. > Is there a simpler way

Re: [Tutor] linux terminal coloring in python

2007-09-29 Thread Tiago Saboga
On Sat, Sep 29, 2007 at 08:32:37AM -0700, Robert Jackson wrote: > I'm trying to get some pretty colored output for a Linux console / terminal window. Google searches only reveal the curses module to colorize output. > Is there a simpler way? Curses seems to be FAR too powerful for what it is I

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread Kent Johnson
James wrote: > Here's the output of the requested commands: > > >>> import threading > >>> threading.__file__ > '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.pyc' > > > >>> > > Looks identical to the output you attached. Strange. How about >>> import threading

Re: [Tutor] Learning Python

2007-09-29 Thread Kent Johnson
Fred P wrote: > 1) How do I get Started? The official tutorial is quite accessible if you have some programming experience. More tutorials are listed here: http://wiki.python.org/moin/BeginnersGuide/Programmers > 2) Recommend any specific Books? I like Learning Python (O'Reilly) Python in a Nu

Re: [Tutor] Learning Python

2007-09-29 Thread Michael Langford
errhttp://www.diveintopython.org is the actual url =Michael On 9/29/07, Michael Langford <[EMAIL PROTECTED]> wrote: > http://www.diveintopython.com is a *Great* start for experienced > software developers. Within a weekend with that book I'd written an > entire parser/decompiler wh

Re: [Tutor] Learning Python

2007-09-29 Thread Michael Langford
http://www.diveintopython.com is a *Great* start for experienced software developers. Within a weekend with that book I'd written an entire parser/decompiler when I'd never used python before that. --michael On 9/29/07, Fred P <[EMAIL PROTECTED]> wrote: > Hey Everyone, > > I am comple

[Tutor] Learning Python

2007-09-29 Thread Fred P
Hey Everyone, I am completely new at python, but not new to programming or scripting. I have a couple of years of LUA scripting experience, about a year of C++ classes, and used to be very efficient at c-shell scripting in unix. My question for you guys: 1) How do I get Started? 2) Recom

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread James
Here's the output of the requested commands: >>> import threading >>> threading.__file__ '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ threading.pyc' >>> Looks identical to the output you attached. .james On Sep 29, 2007, at 2:58 PM, Kent Johnson wrote: > James wrote:

Re: [Tutor] Error Using Logging Module

2007-09-29 Thread Kent Johnson
James wrote: > Traceback (most recent call last): >File "./script.py", line 225, in > sys.exit( main() ) >File "./script.py", line 119, in main > filemode='w') >File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ > python2.5/logging/__init__.py", line 1237, in basi

[Tutor] linux terminal coloring in python

2007-09-29 Thread Robert Jackson
I'm trying to get some pretty colored output for a Linux console / terminal window. Google searches only reveal the curses module to colorize output. Is there a simpler way? Curses seems to be FAR too powerful for what it is I want to do (simply to colorize a few 'print' outputs to the console

[Tutor] Error Using Logging Module

2007-09-29 Thread James
All, I'm having some trouble using the Python logging module. Here's the snippet of code that's causing problems: # setting up logging using Python's logging module LOGFILE = "/home/james/log" logging.basicConfig( level=logging.DEBUG, format='%

Re: [Tutor] Check if root

2007-09-29 Thread James
I've used something like this successfully in the past: import commands if commands.getoutput( "whoami" ) != "root": sys.exit( "Must be root!" ) Hope this helps. .james On Sep 28, 2007, at 7:31 PM, Robert Jackson wrote: > I'm trying to write a function that checks to see if the user th

Re: [Tutor] Check if root

2007-09-29 Thread Norman Khine
Robert Jackson wrote: > I'm trying to write a function that checks to see if the user that > is running the python script is 'root' (I'm obviously running this > Python program on Linux). > > > > Using os.system(), I have done something like this: > > import os > os.system("whoami")

Re: [Tutor] Check if root

2007-09-29 Thread Joshua Simpson
On 9/28/07, Robert Jackson <[EMAIL PROTECTED]> wrote: > > I'm trying to write a function that checks to see if the user that > is running the python script is 'root' (I'm obviously running this > Python program on Linux). Why not just use os.geteuid() ? import os if os.geteuid() != 0: print "

Re: [Tutor] strategy in dealing with user input

2007-09-29 Thread Kent Johnson
Robert Jackson wrote: > I have a few lines of code as follows: > > CONFIGFILE = raw_input("Enter config location: ") > while CONFIGFILE == "": > CONFIGFILE = raw_input("You must enter configuration file location: > ") > > Let's say the user hits enter past the initial raw_input requ

[Tutor] strategy in dealing with user input

2007-09-29 Thread Robert Jackson
I have a few lines of code as follows: CONFIGFILE = raw_input("Enter config location: ") while CONFIGFILE == "": CONFIGFILE = raw_input("You must enter configuration file location: ") Let's say the user hits enter past the initial raw_input request. The user will then be in the whi

Re: [Tutor] Check if root

2007-09-29 Thread Kent Johnson
Robert Jackson wrote: > I'm trying to write a function that checks to see if the user that > is running the python script is 'root' (I'm obviously running this > Python program on Linux). > > > > Using os.system(), I have done something like this: > > import os > os.system("whoami")

Re: [Tutor] detecing palindromic strings

2007-09-29 Thread Kent Johnson
Christopher Spears wrote: > my_str = raw_input("Enter a string: ") > > string_list = [] > > for s in my_str: > string_list.append(s) This can be written: string_list = list(my_str) Kent ___ Tutor maillist - Tutor@python.org http://mail.pyth

[Tutor] Check if root

2007-09-29 Thread Robert Jackson
I'm trying to write a function that checks to see if the user that is running the python script is 'root' (I'm obviously running this Python program on Linux). Using os.system(), I have done something like this: >>> import os >>> os.system("whoami") robert 0 >>> If I try to assign the o

Re: [Tutor] creating the equivalent of string.strip()

2007-09-29 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote > I'm not sure how to proceed. My biggest stumbling > block is how to detect the leading and trailing > whitespace. Use indexing. Recall str[-1] is the last character str[0] is the first... Try using a while loop. Or maybe two? And strings hav

Re: [Tutor] for vs while

2007-09-29 Thread Alan Gauld
"James" <[EMAIL PROTECTED]> wrote > I have a dumb question...hopefully someone can shed some light on > the > difference between for and while in the situation below. You got the basic answer but I'll just add a comment. while is your basic type loop, same as in C and most other languages. for