[Tutor] need help

Dave Angel d at davea.name
Thu Nov 1 23:15:03 CET 2012


On 11/01/2012 05:55 PM, Matthew Ngaha wrote:
>> If you got an error, quote it in full in your message (using copy/paste,
>> not by retyping or paraphrasing.  As it stands, we don't know if the
>> error was in bash, in csh, in cmd, or in Python, and if it was in
>> python, we don''t know what version.
>>
>>> python3 -m http.server
>> Where did you type that?  Was it in a shell, or the interpreter, or in
>> IDLE, or someplace else complicated?
>>
>
>> You've already got one response showing it working with Python 3.3 on
>> OSX.  it also works here, running Python 3.2 on Linux.  But you don't
>> say what version, nor what OS.  I'd also ask what directory you're
>> running it in.
>>
>> davea at think:~/temppython$ python3 -m http.server
>> Serving HTTP on 0.0.0.0 port 8000 ...
>>
> i type it in both IDLE and CMD. in the directory where i made those .html
> files, i held shift and right clicked to get the command line open. im on
> windows vista. the i type that line in there. i use Python 3.1
>
> also i made a .py file in that folder. opened it for editing, then pressed
> F5 to run it., then type the code into IDLE's interactive interpreter.
> which is where i got the invalid syntax error:
>
>  SyntaxError: invalid syntax (<pyshell#0>, line 1)
>
>

Don't run it from inside IDLE.  You were right to run it from cmd.

Pasting the error message you showed elsewhere:

'python3' is not recognized as an internal or external
command, operable program or batch file.

That simply says that the PATH does not point to your PYTHON3.bat or PYTHON3.exe program.  When I was stuck on Windows, I used the ActivePython version, as it had many enhancements for Windows users over standard CPython.  One of those enhancements was a simpler install that set up associations and paths automatically.  Consequently, I don't have any idea how your Windows install tried to set up your PATH.  Look in a directory like  C:\Python3.1 to see if it's there at all.  And if it is, add it to your PATH.  That's a Windows thing, which you can do from the control panel.  But for testing, you can just manually add it to the path of your current cmd shell.

In case you didn't know, PATH is an environment variable used by the cmd shell (and other programs) to search for .exe, .bat, and .cmd programs.



-- 

DaveA



More information about the Tutor mailing list