I would like some help transpiling a relatively simple python package called boolean.py (the package does boolean algebra operations) into javascript using transcrypt as my transpiler of choice.
Things I have done so far:
- Dropped using
inspectmodule which seems to not be supported bytranscrypt - Switched to explicit
SuperClassName.__init__()calls instead ofsuper(SuperClassName, self).__init__()in python code becausetranscryptonly supports simple single-case inheritance (and python 3 syntax).
You can find the current code here in this github branch called transcrypt.
Now, the good news is that boolean.py is essentially a single .py file under boolean/boolean.py, everything else is just python project structure. The bad news is that boolean.py runs on both python2 and python3 and I don't know if that is what causes the current issue that I am about to describe:
Having read the relevant sections of transcrypt docs, I transpile the file:
cd boolean/ && transcrypt boolean.py
This gives me a single harmless warning about basestring and creates the __javascript__ folder with boolean.js and boolean.min.js. So far, so good.
Next to the __javascript__ folder I create boolean.html to test:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>transcrypt boolean.py</title>
</head>
<body>
<script src="__javascript__/boolean.js"></script>
</body>
</html>
However, when I load boolean.html in firefox, the console gives a warning:
TypeError: can't assign to properties of (new String("all_feature_namesnested_scopes,generators,division,absolute_import,with_statement,print_function,unicode_literals,barry_as_FLUFL,generator_stop")): not an object
Instead, what I am expecting to see is a boolean object that has BooleanAlgebra subobject. Refer to hello and pong examples of transcrypt to see that it creates hello and pong objects on window accordingly.
Could you help explain what I am doing wrong here?