0

I'm using portable-python and haven't been able to find a way of linking .py files to the portable-python interpreter (meaning I can't just double click my scripts to run them). I've been getting around this by dragging scripts into the path portable-python checks and then importing them.

ex:

import random_py_file

but is there a way to substitute the name of the file with its absolute/relative path?

ex:

import C:\file\script.py
asked Jan 4, 2013 at 19:22

1 Answer 1

1

This works on linux; however, I am not sure about windows. Essentially what you are doing is adding a path where python will look to find your script.

sys.path.append('C:\file')
import script

Look here to find how to make this permanent.

answered Jan 4, 2013 at 19:25
Sign up to request clarification or add additional context in comments.

3 Comments

Does this fully answer your question?
Would be good to have a way to make the path permanent, but as I worded my question this is a good answer.
Updated the answer to include this.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.