file access in jythonc

Alan Kennedy alanmk at hotmail.com
Sat Aug 21 11:30:30 EDT 2004


[John Howard]
> I have the following in a jythonc program to be executed in a html
> file.
> 
> f1 = open("filename","r")
> 
> I get message about filePermission read error. Program compiles and
> jar file is created. Just the html code gives message.
> 
> Any ideas?

I am presuming that when you say "executed in a html file" you mean that 
this code is to be embedded in a rendered html page as displayed in a 
browser, such as mozilla or ie, which means that your code is an 
"applet", and thus allowed to execute only in the "applet sandbox" 
inside that browser. Which significantly restricts the access rights of 
the applet to access system resources such as local files, for a range 
of very good security reasons, described here

http://java.sun.com/docs/books/tutorial/applet/overview/security.html
http://java.sun.com/docs/books/tutorial/security1.2/overview/

You can approach the problem by

1. Digitally signing your applet or jar file.
http://www.jguru.com/faq/view.jsp?EID=11475

2. Configuring the your browser to permit file access to local files 
(potentially opening a massive security hole in your browser).
http://www.developer.com/java/ent/article.php/630621

HTH,

-- 
alan kennedy
------------------------------------------------------
email alan:              http://xhaus.com/contact/alan



More information about the Python-list mailing list