I have this code:
<script type="text/python" src="https://cdn.jcubic.pl/StringIO.py"></script>
<script type="text/python">
f = StringIO()
</script>
(StringIO came from https://svn.python.org/projects/python/trunk/Lib/StringIO.py with removed __main__
because it get executed)
and got error:
Traceback (most recent call last):
NameError: name 'StringIO' is not defined
How can I import python library from URL? Is there a way?
UPDATE found it that in Python 3 and Brython StringIO
is in io
module but still I would like to know how to import module from url if it's possible.
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/cea5c4b8-be03-47bb-8f32-aa70c12604ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
can you explain in detail please this part
-Pre-compile the files to js using the scripts utilities in the brython repo and then load the js files when the page is loaded.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/fdc86d60-acd0-43aa-81a6-8e261d5d2de5%40googlegroups.com.
>
> 2. If you need to import files from a completely different location, you
> need to worry about Cross-origin resource sharing as Kiko mentioned in
> another reply. I do this as well inside my program, but use a modified
> version of jquery to do so, together with a third party server acting as an
> intermediary. If you need to do something like this, I can point out what I
> do.
>
It's true this is the current situation . Nevertheless IMHO there
should be an easy way to do this, and Brython should do its best
effort to (silently) handle all this .