Skip to content Skip to sidebar Skip to footer

Ioerror When Trying To Open Existing Files

I have a small issue with a python program that I wrote to extract some information from a special text file. The loop (code below) needs to execute my function extract_zcoords() o

Solution 1:

Probably, you should use os.path.join when you call

zdata.extend(extract_zcoord(filename))

like this:

zdata.extend(extract_zcoord(os.path.join(location, filename)))

Solution 2:

You need to join the dirname and filename into one complete path:

location = '/Users/spyros/Desktop/3NY8MODELSHUMAN/HomologyModels'for filename inos.listdir(location):
    filename = os.path.join(location, filename)

Post a Comment for "Ioerror When Trying To Open Existing Files"