Page 1 of 1
[SOLVED] Error when import compiled mpy bytecode
Posted: Wed Sep 13, 2017 8:14 am
by ajie_dirgantara
This is the first time I've use mpy-cross
and I've got this error when import the module :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid syntax for number
any thoughts?
Re: Error when import compiled mpy bytecode
Posted: Wed Sep 13, 2017 8:19 am
by pythoncoder
Most of these issues result from using an out-of-date cross compiler. Each time you pull from the repository it's wise to rebuild the cross compiler.
Re: Error when import compiled mpy bytecode
Posted: Tue Sep 19, 2017 6:54 am
by ajie_dirgantara
pythoncoder wrote:Most of these issues result from using an out-of-date cross compiler. Each time you pull from the repository it's wise to rebuild the cross compiler.
Ok, actually I am using the latest release (version 1.9.2) and did not do any changes...
if I am putting my .py in /modules to compiled into frozen byte code, it is works fine, but why can't I compile and use it externally just like .py files?
Re: Error when import compiled mpy bytecode
Posted: Tue Sep 19, 2017 9:43 am
by pythoncoder
Is it possible you have a (faulty) file with the same name but a .py extension? Otherwise I think you'll have to post a code sample that fails. The cross compiler works fine here.
Re: Error when import compiled mpy bytecode
Posted: Tue Sep 19, 2017 9:48 am
by ajie_dirgantara
pythoncoder wrote:Is it possible you have a (faulty) file with the same name but a .py extension? Otherwise I think you'll have to post a code sample that fails. The cross compiler works fine here.
Ok, I attached the code. it is a pure python aes CBC/EBC implementation. it works as a script, but not as a compiled bytecode though.
Re: Error when import compiled mpy bytecode
Posted: Tue Sep 19, 2017 10:11 am
by pythoncoder
I cross compiled that, copied it to a Pyboard V1.1 and imported it without error.
Re: Error when import compiled mpy bytecode
Posted: Tue Sep 19, 2017 10:40 am
by ajie_dirgantara
pythoncoder wrote:I cross compiled that, copied it to a Pyboard V1.1 and imported it without error.
ok, I found the problem.
need this line listed on mpconfigport.h when compile :
Code: Select all
#define MICROPY_ENABLE_COMPILER (1)
wonder why it isn't enabled by default.