Posts: 4
Threads: 1
Joined: Aug 2018
Aug-01-2018, 08:13 PM
(This post was last modified: Aug-01-2018, 08:14 PM by newbie.)
hi
im learning python for about 5 minutes now and trying to run python from a windows terminal(giving the directory to the termminal so the terminal finds and run it) and im having this error:
SyntaxError: unexpected character after line continuation character.
my code is:
and its the same as the example in the book(Python Crash Course) but i have no clue what is wrong.
any idea what is this for?
OS: Windows 10
Python V 3.7.0
Posts: 12,038
Threads: 487
Joined: Sep 2016
this is not code, it's a OS command to change directory
from command line, if you want interactive python, simply type:
if you want to run a python script, for example myscript.py, use:
Posts: 4,220
Threads: 97
Joined: Sep 2016
That's not Python. That's the Windows command to change directories. You would type that at the Windows command line to get to the Python folder on your desktop.
Posts: 4
Threads: 1
Joined: Aug 2018
Aug-05-2018, 07:29 PM
(This post was last modified: Aug-05-2018, 07:29 PM by newbie.)
(Aug-01-2018, 09:07 PM)Larz60+ Wrote: this is not code, it's a OS command to change directory
from command line, if you want interactive python, simply type:
if you want to run a python script, for example myscript.py, use:
lol, thx but got nothing out of it yet.
error is (in the os command window):'C:\' is not recognized as an internal or external command,
operable program or batch file.
tried this with all three ways u said and still nothing.
checked the directory and it was not wrong.
Posts: 12,038
Threads: 487
Joined: Sep 2016
drop c:\
type what I show verbatim
Posts: 4
Threads: 1
Joined: Aug 2018
(Aug-05-2018, 08:47 PM)Larz60+ Wrote: drop c:\
type what I show verbatim
still nothing, just an "invalid syntax" error.
copied ur lines and changed my folder names to them exactly.
thx tho, maybe i can find the way to do this on utube.
Posts: 12,038
Threads: 487
Joined: Sep 2016
please show everything on your screen, including prompts, etc.
There is something wrong here,
for example if you see >>>
show that and everything else.
Posts: 4
Threads: 1
Joined: Aug 2018
Aug-09-2018, 06:08 AM
(This post was last modified: Aug-09-2018, 06:08 AM by newbie.)
(Aug-06-2018, 07:55 PM)Larz60+ Wrote: please show everything on your screen, including prompts, etc.
There is something wrong here,
for example if you see >>>
show that and everything else.
this is what happens in command window:
C:\Users\admin\Desktop>C:\> cd Desktop\Python
'C:\' is not recognized as an internal or external command,
operable program or batch file.
it also makes a file named "cd" in my desktop and its empty.
Posts: 12,038
Threads: 487
Joined: Sep 2016
Aug-09-2018, 12:28 PM
(This post was last modified: Aug-09-2018, 12:29 PM by Larz60+.)
[python]cd stands for change directory.
Why are you trying to change director while trying to run python?
type the following verbatim from command line:
Output: python
nothing more, nothing less. Got it???
Posts: 7,324
Threads: 123
Joined: Sep 2016
Aug-09-2018, 06:04 PM
(This post was last modified: Aug-09-2018, 06:05 PM by snippsat.)
cmd tutorial
Python 3.6/3.7 and pip installation under Windows
A run in cmd:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
Microsoft Windows [Version 10.0 . 17134.165 ]
(c) 2018 Microsoft Corporation. Med enerett.
C:\Windows\System32>cd\
C:\>python - V
Python 3.7 . 0
C:\>pip - V
pip 18.0 from c:\python37\lib\site - packages\pip (python 3.7 )
C:\>cd foo
C:\foo>more hello.py
print ( 'hello world' )
C:\foo>python hello.py
hello world
C:\foo>python
Python 3.7 . 0 (v3. 7.0 : 1bf9cc5093 , Jun 27 2018 , 04 : 06 : 47 ) [MSC v. 1914 32 bit (Intel)] on win32
Type "help" , "copyright" , "credits" or "license" for more information.
>>> a = 'foo'
>>> a * 5
'foofoofoofoofoo'
>>> exit()
C:\foo>
|
When i type command is only text marked in blue.
C:\Windows\System32> cd\
C:\foo> python hello.py
C:\foo> more hello.py
|