[Tutor] include remote module

Patrick optomatic at rogers.com
Sat Sep 12 19:35:28 CEST 2009


Hey Patrick

What I great idea. I did not even know about the compile function. Maybe
this idea could really work.

Imagine if I gave a client a live Linux CD that automatically called
this sort of script right after boot up. They could have the absolute
most current version of an application from my server launched on their
box and if their data from that application was re-uploaded back to the
server they would have a desktop application with persistence and
assuming the hard drive was not mounted in the process(or it was but
they could trust me), they would also have fairly secure environment to
work in. It would not be perfect yet but it would be safer then using
closed source applications.

Thanks again and thanks to Rich, Allan and Wayne too-Pat

Patrick Sabin wrote:
> Maybe something like this helps you to solve your problem:
>
> # get code via http, etc.
> code = """
> def blah():
> print 'blah'
>
> print 'hello'
> blah()
> """
>
> compiled_code = compile(code, 'filename', 'exec')
> exec(compiled_code)
>
> This way you could execute some code from a web client, but the client
> would be able to execute any code, he could even delete your hard drive.
>
> - Patrick
>
> Patrick schrieb:
>> Hi Wayne
>>
>> Thanks for your help. I was thinking of the latter but now that I think
>> of it, once you import a module it won't help to modify that module on
>> the fly later anyways, right? I would need to re-import it. Sounds like
>> reading it via http would be simpler.
>>
>> Thanks again-Patrick
>>
>> Wayne wrote:
>>> On Sat, Sep 12, 2009 at 7:55 AM, Patrick <optomatic at rogers.com
>>> <mailto:optomatic at rogers.com>> wrote:
>>>
>>> Strange question.....
>>>
>>> Is it possible to include a module that is on another computer?
>>>
>>> I have been day-dreaming about a project that would allow web code to
>>> drive a desktop App.
>>>
>>>
>>> I know of one way, using sshfs, which allows you to mount an ssh
>>> location as a directory on your computer. Then it would effectively be
>>> a local filesystem. I don't know if there's something like that on
>>> Windows.
>>>
>>> Of course, what do you mean when you say "web code to drive a desktop
>>> app"? Do you mean you want to host some code that others can connect
>>> to that will change? Or do you mean you want people to connect to your
>>> server and it will run an app on your desktop?
>>>
>>> For the former it's not really necessary to include the mod on another
>>> computer. Just use the http libraries and download the file when the
>>> script runs. Then import it.
>>>
>>> HTH,
>>> Wayne
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



More information about the Tutor mailing list