Hi there,
Perhaps someone can help me. For some reason, when my Python script
runs and loads an HTML page in a new browser window at the local host
(desktop), the links to my stylesheet and all the images are broken. I
did check the HTML file by itself...everyt hing loaded fine ;)
Here's my script:
--------------------
# File: webbrowser-test.py
import webbrowser, SimpleHTTPServe r
from StringIO import StringIO
f=open('testpag e.html', 'rb')
myPage = f.read()
class MyRequestHandle r(SimpleHTTPSer ver.SimpleHTTPR equestHandler):
def send_head(self) :
self.send_respo nse(200)
self.send_heade r("Content-type", "text/html")
self.end_header s()
return StringIO(myPage )
webbrowser.open ("http://127.0.0.1:8000" , new=0, autoraise=1)
SimpleHTTPServe r.test(MyReques tHandler)
--------------------
Here's my sample directory:
---------------------------------
webbrowser-test.py
testpage.html
m_files/
|_____styleshee t.css
|_____logo.gif
--------------------------------
Thanks for having a look. My next step is to process form input using
AJAX. I'll post working snippets of code here as I progress.
Ben
Perhaps someone can help me. For some reason, when my Python script
runs and loads an HTML page in a new browser window at the local host
(desktop), the links to my stylesheet and all the images are broken. I
did check the HTML file by itself...everyt hing loaded fine ;)
Here's my script:
--------------------
# File: webbrowser-test.py
import webbrowser, SimpleHTTPServe r
from StringIO import StringIO
f=open('testpag e.html', 'rb')
myPage = f.read()
class MyRequestHandle r(SimpleHTTPSer ver.SimpleHTTPR equestHandler):
def send_head(self) :
self.send_respo nse(200)
self.send_heade r("Content-type", "text/html")
self.end_header s()
return StringIO(myPage )
webbrowser.open ("http://127.0.0.1:8000" , new=0, autoraise=1)
SimpleHTTPServe r.test(MyReques tHandler)
--------------------
Here's my sample directory:
---------------------------------
webbrowser-test.py
testpage.html
m_files/
|_____styleshee t.css
|_____logo.gif
--------------------------------
Thanks for having a look. My next step is to process form input using
AJAX. I'll post working snippets of code here as I progress.
Ben