metapensiero/metapensiero.pj

TransformationError: Node type 'Global': Line: 37, column: 4. No transformation for the node

Morsmalleo opened this issue · 5 comments

Being given this error when tryin to run python3 -m metapensiero.pj source.py

 TransformationError: Node type 'Global': Line: 37, column: 4. No transformation for the node

Obviously this is being caused by my Python file at line 37, column 4, with "Global", are there anywork arounds for this does anyone know, or is there something I can tweak or add to metapensiero.pj to fix this, PS I am new to metapensiero.pj so go easy :)

  • yes I have named my python file as source.py to keep it simple
  • I have setup metapensiero.pj using this github repository by running the command sudo pip3 install git+https://github.com/metapensiero/metapensiero.pj provided by a user on a seperate issue
  • Getting the error when running python3 -m metapensiero.pj source.py & python3 -m metapensiero.pj -5 source.py
  • Python3 version is 3.9.2
  • Pip version is Python3-pip 20.3.4-4

Hi @Morsmalleo, could you share the fragment of the code that generates the error?

Hi @Morsmalleo, could you share the fragment of the code that generates the error?

I sure can, I'll do that very soon for you :)

Hi @Morsmalleo, could you share the fragment of the code that generates the error?

Hi @azazel75 sorry it took me so long but here is the fragment of code you asked for from my source.py file which I have now renamed to file.py

global app_icon, app_name, protect_title, protect_desc, key_pass

Unfortunately global declaration isn't something supported right now, anyway if those variables are defined in an outer scope, pj will not redefine them, for example:

$ pj -s -
foo = 'bar'

class Baz:
	def blob(self):
		foo = 1
		other = 2

var foo;
foo = "bar";
class Baz {
    blob() {
        var other;
        foo = 1;
        other = 2;
    }
}

if you don't want any var statement for them you can use from __globals__ import statement, see the readme

Thank you for the information