Question

I get the above error when I run this code:

from os import path, access, R_OK

ODBf = 'C:/Abaqus_JOBS/Reliability/Job-M1/Job-M1-3_run_rel2.odb'

if path.isfile(ODBf) or access(ODBf, R_OK):
    print 'file exists'

The file exists and the path to the file is correct. Where is the error? Thanks

Was it helpful?

Solution

Sounds like you're trying to run the code inside the Python interpreter by using a function called runfile, but there's no such function built-in to Python.

Assuming your script is in a file called myscript.py, it's most common to run a script from a command-line interpreter with...

$ python myscript.py

...although on Python 2.x, you can run it from inside the Python interpreter with...

>>> execfile('myscript.py')

See this question for the Python 3.x equivalent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top