Giter Site home page Giter Site logo

empythoned's People

Contributors

amasad avatar max99x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

empythoned's Issues

Is there any way to complete HTTP requests inside python script

I'm running this example script on Empythoned Demo

import urllib
print urllib.urlopen("http://ipv4.icanhazip.com/").read()

I got an error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/python2.7/urllib.py", line 26, in <module>
    import socket
  File "/lib/python2.7/socket.py", line 47, in <module>
    import _socket
ImportError: No module named _socket

So, I need to make a HTTP request inside python script. Is there any way?

Hangs iOS Safari.

In the compiled code the run function is too big for iOS and should be split into several functions.

Example dist/index.html does not work due to Issue 6

First of all, I'd like to say how amazed I was when I saw this. Truly fantastic!

Unfortunately, I was not able to get empythoned working on my local machine as it did on repl.it. Running locally (via Django) produces the error:

XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.
python.opt.js:229 Uncaught Error: INVALID_ACCESS_ERR: DOM Exception 15

This seems to be the same issue that was fixed in Issue #6, which was fixed 24 days ago. However, I note that the source in the respository has not be updated in 8 months. Has the fix simply not been reflected in the repository? Or is there something else that I need to do?

I'd absolutely love to use this. :)

time.sleep doesn't work

I get an

Internal error: ReferenceError: _select is not defined

when trying to invoke

time.sleep(10)

import antigravity fails!

import antigravity
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/python2.7/antigravity.py", line 2, in <module>
    import webbrowser
  File "/lib/python2.7/webbrowser.py", line 9, in <module>
    import subprocess
  File "/lib/python2.7/subprocess.py", line 429, in <module>
    import select
ImportError: No module named select

This happens because the module tries to import the webbrowser module.
One way to go with it is to print http://xkcd.com/353/.

How to use this project with other libraries ?

Can you explain the process how the this code was generated? Is Cpython code converted using emscripten? if so can you please explain the steps.

In order to use empythoned in my project, is it enough to load dist/worker.js in my html and which will load dist/python.opt.js?

Can't build empythoned

Hello,

I seem to be getting some errors when trying to build. I'm invoking the build script by running "./build". I've set the proper variables located at the top of both "build" and ccproxy.py. I am receiving the following error output after the build script runs for a little bit: (~10 seconds or so)

Potential incompatible plugin version. GCC: 4.6 (20120301). Expected: 4.6 (20120301)
Defines 'dragonegg_disable_version_check' as env variable to remove this warning
Please note that unexpected errors might occur.
../ccproxy.py -DNDEBUG -g -O3 -Wall -Wstrict-prototypes Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/pgenmain.o -ldl -lutil -o Parser/pgen
/usr/bin/llvm-link: Parser/acceler.o:1:1: error: expected top-level entity
�ELFH4(U���(��E�E�E�E�H��U�M��!�E�$�M�L$�<�E���M�M�E�E�M�����E�M�}ˋE��@��(]Ív��'U���(�E
��M�E�E�M�M�E��M�Q�E�U��$�E�$�M�L$���E���M���E�M�E�M�U�9J
�M�E��ȃ�(]�f�U���8��E�E�E�E��@�H��U�M��f��M�Q�E�U��0�E�xt�E�H�
$������E��@�M܃����M�E�E�M�U�9J
�M܉E����E���M؉M�E�E�M�����E�M�}���8]Ð��&U��SWV���E
��M�E�E�M�E�M�E��U��B�4����M�|6�E�
���t�E�
��M���E܋E܉$������E���E؋E؃��E�uO���$�5�$�D$�D$�t$
�MЉU��������$�MȉE��������E���E��
��U��
^
/usr/bin/llvm-link: error loading file 'Parser/acceler.o'
/usr/bin/llc: Parser/pgen: Could not open input file: No such file or directory
gcc-4.6: error: Parser/pgen.tmp.o: No such file or directory
gcc-4.6: fatal error: no input files
compilation terminated.
Traceback (most recent call last):
File "../ccproxy.py", line 100, in
os.unlink(target + '.tmp.o')
OSError: [Errno 2] No such file or directory: 'Parser/pgen.tmp.o'
make: *** [Parser/pgen] Error 1

Any idea as to what might be occuring? I'm trying to compile Python in Javascript with the basic configuration for now. Once I get this working, I plan to add/enable the Python SSL module and hopefully compile/convert that too.

Thanks,
Acejam

Using the Python xlrd library

Hi, I'm trying to use empythoned along with the Python xlrd library to make a JavaScript Excel file reader.
However, I'm running into problems, and I'm hoping someone could help me with some advice.
My approach so far has been to copy all the xlrd files into the virtual files system by passing them into the python interpreter as strings. Is there a better way to add modules? I haven't been successful in figuring out how to create a file system image directly.

The main problem I'm running into is that the xlrd module is only partially imported.

My workspace is located here:
https://c9.io/nathanathan/empythoned

And you can use the execution environment with xlrd in the sandbox directory here:
https://c9.io/nathanathan/empythoned/workspace/index.html

Running the following it appears that only some of the xlrd module is imported.

import xlrd
print dir(xlrd)

(Also, the above script doesn't produce any output on the first execution for some reason.)

/dev/null doesn't exist

os.devnull outputs /dev/null, however it doesn't exists!

Redirecting stdout to /dev/null doesn't work because of this.

repl.it broken on dev FF/Chrome due to sync XHR change on Windows

Firefox and Chrome have disabled ArrayBuffer responses in sync XHRs in their nightly builds, example error:

[10:02:13.078] Use of XMLHttpRequest's responseType attribute is no longer supported in the synchronous mode in window context. @ http://repl.it/jsrepl/sandbox.html
[10:02:13.095] uncaught exception: [Exception... "A parameter or an operation is not supported by the underlying object" code: "15" nsresult: "0x8053000f (NS_ERROR_DOM_INVALID_ACCESS_ERR)" location: "http://repl.it/jsrepl/sandbox.js Line: 322"]

Sync XHRs work without ArrayBuffers, but the better solution is probably to put the compiled code in a worker, where ArrayBuffer still works.

Unable to use `urllib`

import urllib
response = urllib.urlopen("http://python.org")
print response

Code was evaluated using this app yields
Uncaught ReferenceError: _getaddrinfo is not defined in JS console.

While trying same code as chrome extension https://github.com/kracekumar/offline-python

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/python2.7/urllib.py", line 26, in <module>
    import socket
  File "/lib/python2.7/socket.py", line 47, in <module>
    import _socket
ImportError: Could not evaluate dynamic lib: //lib/python2.7/_socket.so

Incorrect results from hashlib functions

All of the hashlib functions that I tried gave incorrect output.

For example, compare this stdlib example code:

>>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

against the result on repl.it:

>>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()
'03143f9f164335fafd05051e0163df081007ba1208d6f9eb4fd3f6fe'

Closure Compiler Advanced Opts

It looks like only simple but not advanced opts are used. However advanced opts usually give a 50%-100% speedup (+smaller code).

Is there a reason for not using advanced opts? Do you need any help with something there?

Incorrect results for three-argument pow

Results from running Python on repl.it, which I'm assuming reflect here:

   pow(2,36,100000)
=> 69184L
   2**36 % 100000
=> 76736L

76736 is the correct result. Also:

   pow(2,40,100000)
=> 127776

which is greater than the passed modulus; it should be 27776.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.