Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 29th, 2006, 4:07 PM   #1
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 908
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
How to run Python scripts in a browser window

I am trying to figure out how to make the Windows (IIS?) system I am using display the output of .py files in a browser window rather than launch the command prompt.

I found this page, which instructed me to edit the registry, although that seems to have had no effect even after I restarted.

However, I'm not sure I did this correctly--I opened regedt32 and navigated to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\, then created a new Multi-String Value named ScriptMap with the value ".py :REG_SZ: c:\<path to python>\python.exe -u %s %s " (no parentheses). The reason I mention this is because I have almost no experience with Windows, and if anyone notices something I'm doing wrong, it would help.

Any ideas? Thanks.
titaniumdecoy is offline   Reply With Quote
Old Jun 29th, 2006, 4:42 PM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
This reference is a little more detailed.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Jun 29th, 2006, 5:28 PM   #3
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 908
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
The link you gave me talks about the "Internet Service Manager (ISM)". Is this a program? If so, how can I find it?

And another thing. I am writing a script that needs to access files on a T: drive which is shared over a network. I don't believe it is set up to be a web server, just such that anyone on the network can access the files on the drive. There is a separate web server that is used for hosting the website which I know has Python installed, but I don't know of any way to access files on the T: drive from it. How can I get around this?
titaniumdecoy is offline   Reply With Quote
Old Jun 29th, 2006, 5:50 PM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by titaniumdecoy
I am trying to figure out how to make the Windows (IIS?) system I am using display the output of .py files in a browser window rather than launch the command prompt.
You could always run the .py programs from a small webserver (such as CherryPy). This seems the most common way of achieving browser-based output on local machines. Google Desktop takes this approach.

Quote:
Originally Posted by titaniumdecoy
There is a separate web server that is used for hosting the website which I know has Python installed, but I don't know of any way to access files on the T: drive from it. How can I get around this?
Why not just access the T: drive using the standard file handling functions, such as os.listdir and open? Presumably, it's the filesystem's job to handle access to the network drive.
Arevos is offline   Reply With Quote
Old Jun 29th, 2006, 6:09 PM   #5
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 908
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Quote:
Originally Posted by Arevos
You could always run the .py programs from a small webserver (such as CherryPy). This seems the most common way of achieving browser-based output on local machines. Google Desktop takes this approach.
I installed CherryPy and followed the instructions to create a Hello World page. It is displayed when I point my browser to http://localhost:8080/. My next question is, will this be accessible from any computer on the network, or only my own computer? And this only seems to work while the command prompt is open, which makes it not very useful.
titaniumdecoy is offline   Reply With Quote
Old Jun 29th, 2006, 6:35 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,034
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
It will be accessible by any computer in the network, if localhost is replaced with your computer's private IP (eg. 192.168.0.110), found by executing the command "ipconfig" (windows only).

It will be accessible by any computer period, if localhost is replaced with your computer's public IP (eg. 64.230.61.156), and port 80 (or in your case, 8080) is forwarded to your computer's private IP (see first paragraph).

If you don't like a window always being open, save it as .pyw and it'll run as a background process (windows only).

Hope this helps.
Sane is offline   Reply With Quote
Old Jun 30th, 2006, 3:39 AM   #7
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by titaniumdecoy
I installed CherryPy and followed the instructions to create a Hello World page. It is displayed when I point my browser to http://localhost:8080/. My next question is, will this be accessible from any computer on the network, or only my own computer?
Across the network, assuming people can get through your Windows firewall (I had some problems with Tomcat on 8080 on that regard). You could also write some code to return an error if the IP address of the computer accessing the page does not match the IP address of the computer running the server. Or just use a standard firewall, and block port 8080 from outside access.
Quote:
Originally Posted by titaniumdecoy
And this only seems to work while the command prompt is open, which makes it not very useful.
As well as Sane's suggestions, you can run CherryPy as a windows service.
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC