Reputation: 904
I'm just getting my feet wet with Python v3.5.2. I've installed IPython via Anaconda and am now attempting to run a simple program.
I wrote a simple print("Hello World!")
script in a text editor and saved it as "C:\Python code\python_practice_code.py".
I've attempted various ways to execute python_practice_code.py, with and without quotes, and I get one of two errors:
In [34]: %run C:\Python code\python_practice_code.py
ERROR: File `'C:\Python/py'` not found.
or
In [35]: ipython 'C:\Python code\python_practice_code.py'
File "<ipython-input-35-30b39bc825d7>", line 1
ipython 'C:\Python code\python_practice_code.py'
SyntaxError: invalid syntax
What am I doing wrong?
Upvotes: 4
Views: 15133
Reputation: 515
It seems backslash or double backslash will not work in windows, similarly when used double or single quotes, shows error like
File
'\'\'"\'"\'C:/Users/xxx.yyy/.ipython/profile_default/startup/50-middle.py\'"\'"\'\'.py'
not found
. Forward slash no quote path works, for example:
%run -i C:/Users/xxx.yyy/.ipython/profile_default/startup/50-middle.py
But need to change all magic command to function call first such as %matplotlib inline
to get_ipython().run_line_magic('matplotlib', 'inline')
, %load_ext autoreload
to get_ipython().run_line_magic('load_ext', 'autoreload')
and etc.
Upvotes: 0