Am Freitag, den 26.05.2006, 08:32 +0100 schrieb Alan Gauld: > <snip> > > IOError: [Errno 2] No such file or directory: ' emmssg.txt' > </snip> > > > > the emmssg.txt file is in the /root/script directory so i > > don't know why it cant find it. > > The file may be there but crontab isn't. It runs the program > as root and root's home directory is /. > > For this kind of thing you need to either pass in the > data directory as an argument or wrap the python script > in a shell script that sets an environment variable to > where your data is and then runs the pyhon script. > Within the script use getenv to find the path.
Well, he can do the following stuff: -) wrap it in a shell script that changes to current directory to the expected one. -) do that inside the python script. -) make the file path absolute somehow: *) code it as a constant int the script. *) make it an argument (see sys.argv or module optparse) *) make it an argument via the environment (os.environ, not getenv) Andreas > > Or just hard code the path... > > Alan G > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor