-1

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

jpcgandre
  • 1,487
  • 5
  • 31
  • 55

1 Answers1

2

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.

Community
  • 1
  • 1
Aya
  • 39,884
  • 6
  • 55
  • 55