simple question

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Mon Nov 4 22:58:15 EST 2002


----- Original Message ----- 
From: xinghua shi 

> Hey, I am new to Python world. I wrote a simple program 
> but got error. Could someone help me fix this? Thanks. 
>
> import sys,os,string 
> 
> pid = os.getpid() 
> 
> filename = ".ld.mon." + str(pid) 
> 
> print filename 
>
>       ^^^^^^^^^^Name error: name "filename" is not defined. 
> 
> Do I really need to define "filename" before use it? I 
> tried char *filename but still didn't work. Thanks for 
> the help. 
 
Your code works fine for me; but you didn't post exactly what
you ran, I'm sure.  Try copying it directly from the screen 
(the error traceback, that is) and also post the actual
text of your module (that is, insert it as an attachment).

You should also tell us what Python version you are using,
as a general practice; although this code should work on all
recent Python installs.

Give us some more info and we'll be happy to help.

Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net






More information about the Python-list mailing list