4

I have a python script developed in Spyder using Python 2.7.4. This script is called from another python script using:

execfile('script.py')

I'd like to know how can I run both python scripts using PyPy (I'd like this because it is faster than standard Python). Thanks!

P.S.: I've already installed PyPy in Windows.

1 Answer 1

7

Run the first Python script using pypy scriptname.py on the command line. The code run by execfile() will also be run in PyPy, because the main script (execfile()) is being run in PyPy.

Sign up to request clarification or add additional context in comments.

4 Comments

when I run pypy from the command line (I had to run it from the source directory) I have this error: pypy Job-M1-3_run2.py File "<stdin>", line 1 SyntaxError: invalid syntax and point to the space between pypy and the script name. Any ideas? Thanks
That means you're in PyPy. The command I gave was a shell command not a Python one.
So I should write pypy scriptname.py for instance in Spyder command line? Thanks
I've not used Spyder, but it should have a place in the settings to specify a command to use for running scripts, or you may even be able to specify multiple configurations (e.g. for Python 2 and Python 3). In the latter case you'd just add PyPy as another configuration and specify the PyPy executable, similar to how Python is specified in the others.

Your Answer

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.