0

I'm sorry if this question is simple but i'm new to Python and have searched around but not found my answer.

Here it is:

How do I run a .py file from the Python interpreter? I'd like to run this file: C:\Users\Myname\Desktop\Python\Python-Test.py

So far, I've:

  • Downloaded Active Python (http://www.activestate.com/activepython).
  • Set the PATH to open the interpreter from the Windows Command Line. The Python interpreter works fine, allowing me to print simple calculations.

Thanks for your time,

Dan.

asked Jul 9, 2013 at 10:23
3

1 Answer 1

1

If you want to know

How do I run a .py file from the Python interpreter?

this will work

import sys
sys.path.append("C:\\Users\\Myname\\Desktop\\Python")
import Python-Test

But your question says from the command line, which has been answered in the comments.

answered Jul 9, 2013 at 10:29
Sign up to request clarification or add additional context in comments.

1 Comment

Consider ticking a answer if it helped

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.