[PythonCE] baseHTTPServer and CGIHTTPServer

Oskar Świda swida at aragorn.pb.bialystok.pl
Tue Jan 4 21:53:03 CET 2005


I suppose I encountered similar problem. The point is - as always about
"current directory" which is not recognized by WinCE.
To make this work just change directory explicitly when starting server
(before calling run).
For example:
 import os
 os.chdir("/Program Files/python/httpTest/")

Then should work.

               Oskar Świda

> When I run my little server.py in a subdirectory on Windows XP , it
> knows where lives, and the browser
> receives the appropriate codes from the response.py script.
> However, when I move the script and server.py to the same file
> structure on WindowsCE, server.py reports that it can't find
> response.py. I believe this is simply another aspect of the fact that
> WindowsCE doesn't recognize local files, and requires that all filenames
> be fully specified. Is there a way to enter the URL into the browser
> with the full path? Like:
> files/python/htmlTest/cgi-bin/response.py" ? Or is it some other setting
> that I need to specify, like some "base File" location that the server
> then searches down from?
> Server.py:
> import BaseHTTPServer
> import CGIHTTPServer
> def run(server_class=BaseHTTPServer.HTTPServer,
>         handler_class=CGIHTTPServer.CGIHTTPRequestHandler,):
>         server_address=('',54321)
>         httpd = server_class(server_address,handler_class)
>         httpd.serve_forever()
> run()
> from the directory where server.py lives(C:/source) in XP, a file
> called /cgi-bin/response.py is readily found when I put
> " into the browser when
> everything's on xp, but not when everything's on CE (/Program
> Files/python/httpTest/). Server.py says it can't find the file.
> Ron
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> http://mail.python.org/mailman/listinfo/pythonce

More information about the PythonCE mailing list