file access in jythonc

John Howard python473 at yahoo.com
Wed Sep 1 23:53:43 EDT 2004


A little history here - my question was that I was getting a filepermission error in trying to read a file from my pc in a jythonc program embedded in html code. I was just asking for a hint to what the problem might be. I am very good at taking a little information and figuring out stuff from there. Somebody referred me to some sites. I looked at these and had no idea where to go from there. So then I asked if what I thought I had read about jythonc was true. That is, is it possible to write python programs and run them under a jvm? Some said yes some said no, depending on security policies, etc. I finally concluded that it was not, based on specs - that is, a jre is necessary at least and maybe even more on opening up ie holes. I guess my frustration probably came through a little. I have done some complicated projects using python, eg - a web site that registers 5000 students in 700 classes, checking for conflicts, full classes, money due, etc, having instructors submit grades,
 and students being able to look up their transcripts and schedules. All done by one person with python and a net1000 server using apache. 
 
What I want to do is have a html page with embedded code read selected data from a specific local file (disk or cd). Having a <input> tag with a "post" requires a server to respond. I want the python program to do the search and display locally. I can do this with code not embedded in html just fine, but the local pc will have to have python installed. I guess freeze will also work, but I really would like to use a gui.
 
I'll stick by my remark - Jythonc (python) is a great language. And, as someone said, I should not blame python for IE security. But, if I cannot access files locally with embedded code, it is useless for me for this project. 
 
My C program will be nowhere near the elegance I desire. It will be a straight forward program run under dos. And probably about 10 times as long and complicated.

John Howard wrote:
 

[John Howard]    

So does that mean that a jre does not have to be on the local pc?      

No: there *must* be a JRE on the local PC: how could the java/jython run at all without an execution environment?The JRE on the local PC is the very thing that is preventing you from reading files from local drives.If you want to, you can permit any and all applet to load files from your local drive. In Internet Explorer, select "Tools->Options"->Security->Custom Level->Microsoft VM->Java Permissions->Custom->Java Custom Settings.In that control panel you can disable all of the protections that your browser puts in place to protect you from hostile applets on the Internet at large. Feel free to dismantle those security barriers, at your own risk: by doing so you're opening the contents of your hard-disk to the world. I Hope you're not storing any private or sensitive information on there.    

The local pc does not have to set policies, etc.       

No, that's precisely where you set policies. Where else could they be set?Alternatively, as others have pointed out multiple times, you can digitally sign your applets so that they can be recognized and thus given more permissions than unknown applets.    

 I said jre, but meant jvm. But your answer is revealing also! Fromwhat you are saying, it is NOT possible to have a html page that canaccess a local file unless at least a jre is present. Again, not good.I think I'll just write the whole project in C. Forget jython!  
I've gone back to re-read the thread to see if I can figure out what you're trying to do and have been unsuccessful.  The only thing I can tell is you want to send a file pointer to the server or something like that.  Are you just trying to upload a file to a server?  If so, I believe you can do that with just plain HTML with an <input> tag.  I'll leave the details between you and Google.  One caveat with this is that the person hitting the webpage will have to browser for the file and then hit the submit button.  If you're wanting it done automatically (or without the user's knowledge/permission), you may want to find an alternative solution that isn't so concerned with unimportant things like security - you could give MS Internet Explorer and ActiveX a spin :-)

I'd like to see the C code you come up with.  If you can write a C program that will run on a server, access a client machine, easily snag a file and pull it back to the server without having a willing and compliant process (say, a JVM, JRE, XMLRPC server, a Microsoft operating system full of exploits) running on the client machine, then I am sure there are a number of folks on alt.2600 that would love to see your source.

Again, it goes back to, What exactly are you trying to accomplish here?

And just one more tip for you - you would do well to watch the "tone of voice" you are using in your postings.  While the folks on c.l.p. are extremely kind, generous and tolerant, you will get farther if you didn't come off quite so abrasive.  Such statements as:

It seems to me that for jythonc to have any use in
development of "practical" products, programs have to be able to
access local files easily. If not, then this, in my opinion, is going
to be a MAJOR issue for jython!!

and

So...are you saying it can be done? That is, a IE can access a local
file (assuming it's there, of course) using a jythonc product? 
Question is -- HOW???

and

>From what you are saying, it is NOT possible to have a html page that can
access a local file unless at least a jre is present. Again, not good.
I think I'll just write the whole project in C. Forget jython!

are not going to make people eager to help you out.  Taking a peek at http://www.catb.org/~esr/faqs/smart-questions.html might help you out.


Jeremy Jones


		
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040901/89f34c0a/attachment.html>


More information about the Python-list mailing list