chrivers / pyjaco

Python to JavaScript translator
http://pyjaco.org
MIT License
140 stars 18 forks source link

When pyjs.py tests/algorithms/fib.py -o fib.js is run via command prompt, pyjs.py opens #83

Open derpasaurs opened 10 years ago

derpasaurs commented 10 years ago

When I run pyjs.py tests/algorithms/fib.py -o fib.js, via command prompt, pyjs.py opens in my IDE. The javascript file does not get written. how can I fix this?

Neppord commented 10 years ago

What OS do you run?

2014-02-20 5:01 GMT+01:00 derpasaurs notifications@github.com:

When I run pyjs.py tests/algorithms/fib.py -o fib.js, via command prompt, pyjs.py opens in my IDE. The javascript file does not get written. how can I fix this?

— Reply to this email directly or view it on GitHubhttps://github.com/chrivers/pyjaco/issues/83 .

Samuel Ytterbrink

derpasaurs commented 10 years ago

windows

Neppord commented 10 years ago

try to prefix pyjs,py with python $ python pyjs.py tests/algorithms/fib.py -o fib.js

2014-02-20 19:23 GMT+01:00 derpasaurs notifications@github.com:

windows

— Reply to this email directly or view it on GitHubhttps://github.com/chrivers/pyjaco/issues/83#issuecomment-35652435 .

Samuel Ytterbrink

derpasaurs commented 10 years ago

yes, this works, but when i open it in note pad: var fib = function() { var __kwargs = __kwargs_get(arguments); var __varargs = __varargs_get(arguments); var $v1 = Array.prototype.slice.call(arguments).concat(js(__varargs)); var x = ('x' in __kwargs) ? __kwargs['x'] : $v1[0]; delete __kwargs.x if (x === undefined) { py_builtins.print('fib() did not get parameter x'); }; if (bool(x.PY$__eq__($c1)) === True) { return x; } else { return x.PY$__mul__(fib(x.PY$__sub__($c1))); } return None; } py_builtins.print(fib($c4));

This is not js. Also how do i put it in my browser

derpasaurs commented 10 years ago

how can i make it JS

Neppord commented 10 years ago

That is JavaScript.

Can someone elese help me out here (ping CI), and explain this?

fredagen den 21:e februari 2014 skrev derpasaurs notifications@github.com:

how can i make it JS

— Reply to this email directly or view it on GitHubhttps://github.com/chrivers/pyjaco/issues/83#issuecomment-35683392 .

Samuel Ytterbrink

derpasaurs commented 10 years ago

whats the : py_builtins.print??

Neppord commented 10 years ago

Its pythons print function, its located in the builtins javascript library that are shipped with pyjaco.

2014-02-21 2:51 GMT+01:00 derpasaurs notifications@github.com:

whats the : py_builtins.print??

— Reply to this email directly or view it on GitHubhttps://github.com/chrivers/pyjaco/issues/83#issuecomment-35691495 .

Samuel Ytterbrink

derpasaurs commented 10 years ago

so: how can I run a python script that will count up to 50 in my web browser?

number = 0
for i in range(51):
    print (number)
    number = number + 1