Reputation: 2753
Is it possible to pass information from the client-side browser using JavaScript to a client-side Python script using Python CGI? I have done some light googling and everything points to server-side Python scripts receiving information from client-side browsers. I have a somewhat unique'ish project that would require the ability to pass this information locally from browser to a local script.
For example I would have a webpage with a table. In each cell in the table would be an image with a checkbox next to it. When I hit submit, the checked unique values from each checkbox that was checked would be pass to a local python script, from which further processing would occur.
Any thoughts on this? Thank you!
Edit - There is likely some confusion to as my oddball question, so a tad bit more clarification. My python script starts out by mounting and walking an NTFS volume, making a list of the path of every graphic file found. It then mounts a RAM disk. The python script then generates thumbnails of each image found. The python script then generates a "master" html page, and then dynamic ammounts of html pages to be used in an iframe. The HTML files and thumbnail files are stored in the RAM disk. The iframe pages contain the thumbnails in tables of all images found on the computer with check boxes next to each thumbnail. After all this information is generated the Python script then opens a browser calling that page in the RAM disk. The user is then supposed to check images of interest, the checked checkbox values are stored in an array. When the user has finished selecting all of their items, the user would submit. What I would like to then happen would be for the array values to be passed to the python script, then the python script would take each item referenced from the values in the array and hash them, then stick the thumbnails onto a PDF, 8 per page, each thumbnail with hash values of the original file, path and modified/accessed/created times from the OS. To generate the hash values of the local image files and get the MAC times I need to access the local machine with Python, as JS lives in it's little sandbox. Hope this makes sense!
Upvotes: 0
Views: 611
Reputation: 7322
You can setup your own local server and connect browser to it. Something has to open connection and something has to listen for connections. So automatically your python client turns into server however it sounds.
Anyway, why you are not using just javascript? Most things can be done with lone js.
UPDATE:
You can also just forget about html and javascript and make everything in python. Check PyQt4, you can make pretty easly your own gui to check images with it.
Upvotes: 1