0

I am trying to encryt a module (ency0) by replacing readable variables with unreadable variables. The encrypted module (ency1) works in PyScripter but not in Python Interpreter.

# ency0 module:
 a,b = 2, 3
 _,__ = a,b


# ency1 module:
 import ency0
 print 5*_+6*__ 
 # expect result = 28 # 

# In Python Interpreter:
 >>>import ency0
 >>>import ency1
 Traceback <most recent call last>:
   File "<stndin>", line 1, in <module>
   File "ency1.py", line 13, in <module>
     print 5*_ + 6*__ 
 NameError: name '_' is not defined
 >>>

In PyScripter I can have a correct result of 28 as long as running ency0 first then ency1 later. If running ency1 only, then I get an error message of name '_' is not defined.

But in Python Interpreter I always have an error message of: name '_' is not defined no matter run ency0 in advance or not.

I belive I missed some very basic statements that always includes in PyScripter by default.

1 Answer 1

2

this is an error because you should access the _ as

ency0._

if you want to use just _ please use

from ency0 import * 

instead of

import ency0

you may always use dir() to print the list of your local variables.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.