Unable to make ironpython run in browser with silverlight

  • Thread starter ErichCart ErichCart
  • Start date
E

ErichCart ErichCart

Basically i am following this tutorial:
http://blog.jimmy.schementi.com/2010/03/pycon-2010-python-in-browser.html
According to it, this code should run fine:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript"
src="http://gestalt.ironpython.net/dlr-20100305.js"></
script>
<script type="text/python" src="http://github.com/jschementi/
pycon2010/raw/master/repl.py"></script>
</head>
<body>
<script type="text/python">
window.Alert("Hello from Python!")
</script>

</body>
</html>

And in fact, it does, for example here: http://ironpython.net/browser/examples/pycon2010/start.html

You will see it if you have silverlight installed.

But the problem is that when I try to make the same code run on my PC,
I can't do it. I create a text file, copy this code there, save it as
test.html, and run with firefox, but nothing happens. Code does not
execute, i just get a blank page. I can't understand the reason why
the same code runs here: http://ironpython.net/browser/examples/pycon2010/start.html,
but not on my PC, given that it is a client side code, and not the
server side.

And there is nothing written in firefox error console, when I run it
locally.
But if I host it on my webhosting account, then I get this error:

Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]"
nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://
sitename .com/silverlighttest.html :: DLR_DownloadResource :: line 15"
data: no]

I uploaded the html file I am using here: http://www.filedropper.com/silverlighttest
But it just a text file with that code with extension changed
to .html.

What can I do?
 
J

Jimmy Schementi

You need to run it from a web-server; it doesn't work when running from file:// due to Silverlight's security sandbox. Read the comments on my blog-post, it mentions the web-server there.
 
S

Sunny

You need to run it from a web-server; it doesn't work when running from file:// due to Silverlight's security sandbox. Read the comments on my blog-post, it mentions the web-server there.

I see..
But here: http://silverlighttest.zzl.org/silverlighttest.html , it
runs from a web server, but still gives error.
And it has the same source code as your example, except that I replace
repl.py with the direct link, as you advise on your blog.

I think the problem is with this part:
<script type="text/python" src="http://github.com/jschementi/pycon2010/
raw/master/repl.py"></script>

Because when I delete it, it runs properly.

Do you know why is that?
 
E

ErichCart ErichCart

You need to run it from a web-server; it doesn't work when running from file:// due to Silverlight's security sandbox. Read the comments on my blog-post, it mentions the web-server there.

I see..
But here: http://silverlighttest.zzl.org/silverlighttest.html , it
runs from a web server, but still gives error.
And it has the same source code as your example, except that I replace
repl.py with the direct link, as you advise on your blog.

I think the problem is with this part:
<script type="text/python" src="http://github.com/jschementi/
pycon2010/
raw/master/repl.py"></script>

Because when I delete it, it runs properly.

Do you know why is that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top