Robert Johansson wrote:

I have some functions written in Matlab which I want to translate into Python so that my friends (how don’t have Matlab) can enjoy them. My program does some work on a bunch of textfiles which I have put in the same directory as the Python-scriptfile with the function definitions. Things run pretty well on my installation (WinXP) but not on my girlfriends Mac (with leopard).

Running the script file she gets error messages claiming that the textfiles cannot be found when they are to be opened with fileid=file(‘textfilename.txt’,’r’) even though the same thing works fine on my system. Anyone how knows what the cause of this is?


When you specify a relative path for the file Python looks in the "current directory".

To see what that is:

import os
print os.getcwd()

I'll bet that on the Mac the files are not in the "current directory".

If that is the case there are several solutions.

--
Bob Gailer
919-636-4239 Chapel Hill, NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to