Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
germanjoey opened this Issue Apr 24, 2012 · 17 comments

Comments

Projects
None yet
3 participants

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. :)

Owner

amasad commented Apr 25, 2012

Because of some browser changes the interpreter needs to be loaded in a Web Worker. Which is done in repl.it and jsrepl.
The interpreter is pretty stable thats why it hasn't been updated and the example is simply outdated.

I also strongly suggest using https://github.com/replit/jsrepl where all that is taken care of.

@max99x could you update the example? or remove it and point to jsrepl?

Owner

max99x commented Apr 25, 2012

I don't want to point people to jsrepl, since it's a much more complex system. I'll try to update the example to use a worker, without making it too complex.

Owner

amasad commented Apr 25, 2012

Understood. But they're going to probably come back and tell you input doesn't work etc.

Owner

max99x commented Apr 25, 2012

Have I mentioned I hate browsers? Digging into the reason for the change that caused all this upheaval I discovered that it was just an attempt to "discourage" people from using sync XHRs, and the reason they applied it only to custom types is because it wouldn't break old apps that don't use custom XHR types that way. /facepalm

Owner

amasad commented Apr 25, 2012

Is it in standard? or just an agreement between browser vendors to bully people to do what they think is right?
but in all honesty they've pushed me to put in the effort to solve the input issue in workers and load all languages in web workers which is just awesome.

Owner

max99x commented Apr 25, 2012

Looks like they added it to a standard (diff of the change). And while I admire your input hacks, they are still ridiculously convoluted ways of doing something that in a sane world would be possible using a much simpler approach.

Owner

amasad commented Apr 25, 2012

I think the problem is a natural problem to have. Trying to block in a single-threaded environment while expecting some other operation to take place (UI) sounds insane. The only possible solution that doesn't break the web browser paradigm is something you also once mentioned. Which is access to the event stack (or call stack could work). which i think while great would bring its own world of problems and security issues.

Owner

max99x commented Apr 25, 2012

A simple acceptable solution would be to add a waitForEvent() function to workers.

Owner

amasad commented Apr 25, 2012

Agreed. But in concept it would be some kind of fiber or coroutine.

Owner

max99x commented Apr 25, 2012

It would be a thread. Exactly what it currently is. No need to complicate things with coroutines, when the two contexts are separate (since each thread has an independent call stack and top level scope).

Owner

amasad commented Apr 25, 2012

Yes that is true.

Thanks, I'll try out jsrepl then. Does it need to be built from source, or can I use the testbench right away?

Oh, unless of course you're going to update the empythoned example - Python's the only language I need here. Again, thanks for all the help!

Hey, just wanted to ping again to see if you had a chance to redo that example. I tried jsrepl out, is very cool, but seems to require nodejs because of the coffeescript. That would be a lot of trouble for me to include in my eventual distro, so I'd still much prefer to go with the seemingly-standalone empythoned here. Anyways, thanks again for the help!

Owner

max99x commented Apr 28, 2012

Disabled array buffer requests in the prebuilt script. Quick hack that may break binary file access, but should allow you to use it for basic tasks.

@amasad amasad closed this in 0268bc5 Apr 29, 2012

Owner

max99x commented Apr 29, 2012

It worked fine without the extra step, but if you went and did it anyway, might as well revert my change. I'm surprised the worker was so little code though. That's nice. But what's the deal with ;(function () {?

Owner

amasad commented Apr 29, 2012

I did revert the changes. Its just a habit. Sometimes when starting with (function and concatenating with another file or moving the code somewhere missing a semicolon at the end it will error out. It looks stupid but it happened to me more than once so its a thing now. hah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment