Closed retorquere closed 2 years ago
Hi Emiliano,
"Emiliano" == Emiliano Heyns notifications@github.com writes:
Emiliano> While compiling files in https://github.com/retorquere/biblib, I'm getting
Emiliano> ```
Emiliano> An error occurred while compiling source file 'test.py'
Emiliano> NameError: name 'hq' is not defined
Emiliano> ```
I'm sorry but i do not know anything about such project. Please ask to its project maintainer
cheers -- Alberto Berti - Information Technology Consultant PGP: 9377 A68C C5B5 B534 36BD F20B E3B5 C559 99D6 7CF9
"gutta cavat lapidem"
The project doesn't use hq and has no outside dependencies.
On Fri, 27 Nov 2020, 17:40 Alberto Berti, notifications@github.com wrote:
Hi Emiliano,
"Emiliano" == Emiliano Heyns notifications@github.com writes:
Emiliano> While compiling files in https://github.com/retorquere/biblib, I'm getting Emiliano>
Emiliano> An error occurred while compiling source file 'test.py' Emiliano> NameError: name 'hq' is not defined Emiliano>
I'm sorry but i do not know anything about such project. Please ask to its project maintainer
cheers
Alberto Berti - Information Technology Consultant PGP: 9377 A68C C5B5 B534 36BD F20B E3B5 C559 99D6 7CF9
"gutta cavat lapidem"
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/metapensiero/metapensiero.pj/issues/53#issuecomment-734915218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAIDFWVWZAI77NX6PHFA3SR7JA5ANCNFSM4UFCME7A .
This error doesn't seem to occur in python 3.8 but can be reproduced in >= 3.9?
Ah -- I'm on 3.9
unfortunately I haven't had the time to test it on 3.9
This error doesn't seem to occur in python 3.8 but can be reproduced in >= 3.9?
Reproducible on python 3.9.1
Yes confirm I see the same issue with Python 3.9.2.
Here's a debug output, seems something to do with macropy
internally with javascripthon
.
[icarito@tengu thunder]$ python3 -m metapensiero.pj -s "print" -d
DEBUG:__main__:Log started
INFO:macropy.core.import_hooks:Expand macros in /home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/transformations/classes.py
INFO:macropy.core.macros:Finding macros in 'metapensiero.pj.transformations.classes'
INFO:macropy.core.macros:Importing macros from 'macropy.core.quotes' into 'metapensiero.pj.transformations.classes'
INFO:macropy.core.macros:Importing macros from 'macropy.experimental.pattern' into 'metapensiero.pj.transformations.classes'
INFO:macropy.core.import_hooks:Expand macros in /home/icarito/.local/lib/python3.9/site-packages/macropy/experimental/__init__.py
INFO:macropy.core.macros:Finding macros in 'macropy.experimental'
INFO:macropy.core.import_hooks:Expand macros in /home/icarito/.local/lib/python3.9/site-packages/macropy/experimental/pattern.py
INFO:macropy.core.macros:Finding macros in 'macropy.experimental.pattern'
INFO:macropy.core.macros:Importing macros from 'macropy.core.quotes' into 'macropy.experimental.pattern'
INFO:macropy.core.macros:Importing macros from 'macropy.core.hquotes' into 'macropy.experimental.pattern'
DEBUG:macropy.core.macros:Found macro 'hq', type 'Block', line 333
DEBUG:macropy.core.macros:Found macro 'q', type 'Block', line 255
DEBUG:macropy.core.macros:Found macro 'switch', type 'Block', line 393
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/__main__.py", line 262, in <module>
main()
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/__main__.py", line 161, in main
res = transform_string(input, es5, es6, stage3,
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/__main__.py", line 112, in transform_string
res, src_map = api.translates(input, enable_es6=enable_es6,
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/api.py", line 144, in translates
t = Transformer(transformations, JSStatements, es6=enable_es6,
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/processor/transforming.py", line 53, in __init__
self.transformations = load_transformations(py_ast_module)
File "/home/icarito/.local/lib/python3.9/site-packages/metapensiero/pj/processor/transforming.py", line 305, in load_transformations
__import__(mod_name)
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 925, in _find_spec
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/import_hooks.py", line 147, in find_spec
code, tree = self.expand_macros(source, origin, spec)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/import_hooks.py", line 110, in expand_macros
new_tree = macropy.core.macros.ModuleExpansionContext(
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 533, in expand_macros
tree = super().expand_macros(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 355, in expand_macros
return self.walk_tree(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 489, in walk_tree
self.walk_children(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 454, in walk_children
new_value = self.walk_tree(old_value)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 489, in walk_tree
self.walk_children(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 459, in walk_children
new_t = self.walk_tree(t)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 489, in walk_tree
self.walk_children(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 454, in walk_children
new_value = self.walk_tree(old_value)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 489, in walk_tree
self.walk_children(tree)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 459, in walk_children
new_t = self.walk_tree(t)
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 480, in walk_tree
new_tree = self.walk_tree(expand_it.send(new_tree))
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/macros.py", line 422, in macro_expand
new_tree = function(
File "/home/icarito/.local/lib/python3.9/site-packages/macropy/core/failure.py", line 29, in clear_errors
return hq[raise_error(MacroExpansionError(msg))]
NameError: name 'hq' is not defined
Yes, I had started using macropy for some transformations but I'm not maintaining it anymore. Now I use javascripthon very seldomly so I don't have a real incentive to make it work with new pythons.. is this still usefu for you guys?
I find I prefer it to other options (I've tried RapydScript-NG, pscript and transcrypt). Each has drawbacks. But my distro (Arch based) packages Python 3.9 only... I'm starting a new project and was thinking of using it.
@icarito Nice to know, can you tell me why you prefer it? Also, on master now there's a basic Python 3.9 support, could you please try it out? and give me feedback?
Hi @azazel75 I'm sorry that I took so long to reply, I'm traveling since a few days ago.
Yes of course I will share with you what I find!
This is a superficial description from memory from experiments in the past 2-3 years. Perhaps you know more deeply what other differences are, advantages/disadvantages.
Blessings and thank you for your very useful response!
I will be trying Javascripthon again and letting you know how it goes!
I'm having this error now on Python 3.9.4. My program in rather simple, doesn't have any dependencies, only imports re
.
I've noticed there's some error with macropy so I updated it. Error changed to this:
@ENDrain Thanks for reporting. Two things:
git+ssh
and git+http
url schemes. See pip's documentation for the details;re
module translations. Just some of the builtins (those you find in the README) are currently translated. So to cut to the chase, if you import and use the re
module in Python, the system will convert the Python import re
statement into an equivalent JS module import of an re
module that you have to provide yourself. Because regexps are a standard JS type, this may not be what you want, and you could use something like this instead:
a = JS('/your js style regexp here/')
This will be translated to
var a;
a = /your js style regexp here/;
Thanks for advice! I've tried both unreleased branch and stable version with 3.6. Neither worked producing different errors. I'll report later
@icarito, do you had the chance to test it out?
Recieving this error with Python3.9.2
setup of metapensiero.pj was done using this git repository
Alberto, I'm so sorry I didn't respond to you at the time, I was travelling and had to abandon my pet project at the time. Bit it it did work, but I haven't tested again!
@Morsmalleo 's message brought it back to my attention.
I've just tested the version in this repository with Python 3.9.9 and it works for me!
Installed it with pip install git+https://github.com/metapensiero/metapensiero.pj
I've just tested the version in this repository with Python 3.9.9 and it works for me!
Installed it with
pip install git+https://github.com/metapensiero/metapensiero.pj
I will try this myself and see if it solves the problem
I've just tested the version in this repository with Python 3.9.9 and it works for me! Installed it with
pip install git+https://github.com/metapensiero/metapensiero.pj
I will try this myself and see if it solves the problem
Yep working for me, just getting a TransformationError: Node type 'Global': Line: 37, Column: 4. No Transformation for the node
error now
Thank you Sebastian, I'll release a new version soon
What can I say, I'm just different... I'm still getting the 'hq' error, and I've done the update above. Anyone else having this problem still?
Thanks, Chris.kelly.tn@gmail.com
I still see the hq
error after pip install git+https://github.com/metapensiero/metapensiero.pj
I still see the
hq
error afterpip install git+https://github.com/metapensiero/metapensiero.pj
What pip version and python version are you using
I still see the
hq
error afterpip install git+https://github.com/metapensiero/metapensiero.pj
What pip version and python version are you using
Python 3.9.5 pip 20.0.2
I still see the
hq
error afterpip install git+https://github.com/metapensiero/metapensiero.pj
What pip version and python version are you using
Python 3.9.5 pip 20.0.2
Try upgrading to 3.9.9 that's what I did and it worked for me
I still see the
hq
error afterpip install git+https://github.com/metapensiero/metapensiero.pj
What pip version and python version are you using
Python 3.9.5 pip 20.0.2
Try upgrading to 3.9.9 that's what I did and it worked for me
I originally tried with python 3.9.2 but upgrading to python 3.9.9 did it for me
Sorry, I discovered that this copy of the repo wasn't in sync with the main on gitlab and so some of the fixes for py3.9 didn't show up here. This error shouldn't happen anymore because macropy isn't used anymore
Please try to install the master from here now
Installing from master solved the issue for me.
A new release 0.12 containing the fixes described here has now been released
While compiling files in https://github.com/retorquere/biblib, I'm getting