why there is no pythonscript insine web browsers?

G

Guest

I'm an old programmer coming from a cobol background and started to
learn python. I'm using javasript for web based applications but after I
started to learn python, the javascript language started to seem ugly to
me. Now I'm wondering why there is java support on web browsers but no
python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.

Please tell me, is there a python substitude for JRE ?
 
D

Diez B. Roggisch

Timuçin Kızılay said:
I'm an old programmer coming from a cobol background and started to
learn python. I'm using javasript for web based applications but after I
started to learn python, the javascript language started to seem ugly to
me. Now I'm wondering why there is java support on web browsers but no
python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.

Please tell me, is there a python substitude for JRE ?

you can use jython (http://www.jython.org) to create applets in Python on
top of the JDK/JRE.

Diez
 
D

Dennis Lee Bieber

I'm an old programmer coming from a cobol background and started to
learn python. I'm using javasript for web based applications but after I
started to learn python, the javascript language started to seem ugly to
me. Now I'm wondering why there is java support on web browsers but no

Note: Javascript and Java are separate languages... (If I recall,
Javascript started life as ECMAscript).
python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.
Javascript is meant to, basically, control the browser and the
contents of HTML pages sent to it. Java support tends to be via plug-ins
-- and tends to exist because the Jave run-time can be sand-boxed to
prevent access to the local machine file system/services. Python can not
be safely sand-boxed (and the early restricted mode modules have been
removed for that reason).
Please tell me, is there a python substitude for JRE ?

There is always Jython (a few generations behind Python but uses the
Java VM rather than Python's). The JRE does not handle Javascript,
though -- so AJAX is still out of the question.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
D

Deli_Llama

One option would be to use jython in conjunction with something like
the google web toolkit(gwt). that way you can write python code, it
will be translated into java by jython (I believe that's how it works)
and then gwt will translate the java into javascript. I haven't done
this myself (and it seems to be quite a roundabout way of getting it
done) but it *should* work.

Alternatively you might want to try something like microsoft
silverlight which runs on the .Net framework and allows you to use
ironpython without any hacks. But that's only if you don't mind using
propreitry software or installing the silverlight runtime.
 
B

bramble

python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.

Javascript is meant to, basically, control the browser and the
contents of HTML pages sent to it. [snip] Python can not
be safely sand-boxed (and the early restricted mode modules have been
removed for that reason).

Why can't it be safely sandboxed?

That is, why not just have a Python interpreter and some safe subset
of the Python standard library run with the browser? I mean, aside
from the work involved with combing out the unneeded or dangerous
parts of the standard lib, it seems like it would be much nicer to
just use Python syntax and modules rather than having to fool around
with Javascript.
 
D

Diez B. Roggisch

bramble said:
python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.

Javascript is meant to, basically, control the browser and the
contents of HTML pages sent to it. [snip] Python can not
be safely sand-boxed (and the early restricted mode modules have been
removed for that reason).

Why can't it be safely sandboxed?

That is, why not just have a Python interpreter and some safe subset
of the Python standard library run with the browser? I mean, aside
from the work involved with combing out the unneeded or dangerous
parts of the standard lib, it seems like it would be much nicer to
just use Python syntax and modules rather than having to fool around
with Javascript.

The problem is that building such an environment would mean building it up
from scratch instead of trying to secure the existing one - wich quite a
few people tried, and failed.

So it's more than "just" creating a sandbox, it's keeping track with
CPython's language features and lib-advances as well.

There are two projects I aware of that might help, IronPython & Jython. The
latter had some hard times getting up to python 2.2 (important for the new
style classes support), but now it's finished in that respect so hopefully
we will see more frequent releases of it, with newer python version
support.

And all this still doesn't tackle the fact that at least one, not to say THE
browser vendor won't adopt python just for the fun of it - they even don't
taclke the flaws of the existing product.

Diez
 
D

Dennis Lee Bieber

Why can't it be safely sandboxed?

That is, why not just have a Python interpreter and some safe subset
of the Python standard library run with the browser? I mean, aside

It's not just the library (at a start you'd need to strip out
modules os, popen, and subprocess), but you'd also need to block out
exec, eval() (and by extension, input() ) from the interpreter core.
Might need to do nasty things to the low-level import mechanism so that
villains can't rig a web site to contain an import module with ability
to access the local file system.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
S

Shane Geiger

At the last PyCon, Brett Cannon told me that he had already implemented
the security architecture (or security template) for Python within
Firefox. However, he did not go forward with the project because he
would not be able to get a PhD from doing it. :)



It's not just the library (at a start you'd need to strip out
modules os, popen, and subprocess), but you'd also need to block out
exec, eval() (and by extension, input() ) from the interpreter core.
Might need to do nasty things to the low-level import mechanism so that
villains can't rig a web site to contain an import module with ability
to access the local file system.


--
Shane Geiger
IT Director
National Council on Economic Education
(e-mail address removed) | 402-438-8958 | http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy
 
C

cyberco

That is, why not just have a Python interpreter and some safe subset
It's not just the library (at a start you'd need to strip out
modules os, popen, and subprocess), but you'd also need to block out
exec, eval() (and by extension, input() ) from the interpreter core.
Might need to do nasty things to the low-level import mechanism

I'm not sure how many modules you need at all. Just being able to use
Python's syntax to control the webpage and parts of the browser would
be a huge win in my eyes.

2B
 
K

kyosohma

I'm an old programmer coming from a cobol background and started to
learn python. I'm using javasript for web based applications but after I
started to learn python, the javascript language started to seem ugly to
me. Now I'm wondering why there is java support on web browsers but no
python support? there is even a vbscript support inside MS-IE but there
is no python support. it would be really nice and easy for me to use
python instead of javascript to write those ajax scripts.

Please tell me, is there a python substitude for JRE ?

You can also use Python's cgi module. It's pretty cool, from what I've
read:

http://docs.python.org/lib/module-cgi.html
http://www.cs.virginia.edu/~lab2q/
http://www.python.org/doc/essays/ppt/sd99east/index.htm

Of course, there's also the many Python web frameworks to choose from
too.

There are more ways to implement Python in the browser than just
trying to replace javascript with Python. Admittedly, they may be too
big a hammer for your needs.

Mike
 
P

Piet van Oostrum

k> You can also use Python's cgi module. It's pretty cool, from what I've
k> read:

CGI is server-side. The OP was asking for client-side embedding of Python.
 
A

Alberto Berti

Piet> CGI is server-side. The OP was asking for client-side
Piet> embedding of Python.

FireFox 3 aka "Gran Paradiso" can be compiled to have python
scripting but for security reasons it can be used only on crome://
urls, which load local content.

there is an xpi package that can be installed on Gran Paradiso alphas:

http://vamposdecampos.googlepages.com/pyxpcom
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top