open file on mac

tinauser tinauser at
Fri Oct 8 16:41:54 CEST 2010

hallo, i'm sorry if the question is very stupid, but i cannot
understand what i'm doing wrong here.

i have this
class Starter:
    def init(self,num):
        print "hithere!"
        print "the answer is ",num
        import sys,os
        print "path:",sys.path
        print "bye"

##            f = open("/Users/lguerrasio/_myfold/",'r')
            f = open("",'r')
            print "huurray!"
        except IOError:
            print "The file does not exist, exiting gracefully"
        print "This line will always print"

the module is in the same folder of initfile
from terminal, i import sys and add to the path /Users/lguerrasio/
then i import the module and call

now,the file will be opened only if i give the full path, not if i
give only the name of the file, although the folder is in the path.
what am I missing?

More information about the Python-list mailing list