0

I need to run a python file using an older python 2.6 version installed with an external software. To do this I have resorted to using os.system such as

os.system('""path/old_python.exe" "file.py""')

(note that the odd no. of ('") is due to the path containing a space c:/program files (x86)/.. as I am running on windows.)

This code string works well if run from a root directory. However, I would like to place this os.system call in a module within a sub-package to my root and thereafter run it from a root module. So the hierarchy would look like this:

/root
    call_os_module.py
    /subpack1
        os_module.py
        file.py

If I run this I receive the error:

path/old_python.exe: can't open file 'file.py': [Errno 2] No such file or directory

I have added the full path to subpack1 to sys.path. However, I still receive the same error and os can't find the file. How do I solve this?

1 Answers1

0

Have a look at these questions:

Community
  • 1
  • 1
User
  • 14,131
  • 2
  • 40
  • 59