uPycraft with mpy file

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
bellad
Posts: 52
Joined: Tue May 14, 2019 1:47 pm

uPycraft with mpy file

Post by bellad » Wed Dec 18, 2019 10:07 am

Hello,
i have compiled my file py in mpy with mpy-cross

it's possible to run mpy file with upycraft ?
if yes , how to ?
because i have

Code: Select all

ValueError: incompatible .mpy file
thank you

Online
User avatar
Roberthh
Posts: 1959
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPycraft with mpy file

Post by Roberthh » Wed Dec 18, 2019 4:46 pm

The versions of the firmware installed on your board and mpy-cross do not match. That's what the error tells.
Which firmware version do you have on the board, and which mpy-cross are you suing?

bellad
Posts: 52
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Thu Dec 19, 2019 9:13 am

version firmware : esp8266-20190125-v1.10
mpy-cross.exe : Micropython v1.11 on 2019-09-15 ; mpy-cross emitting mpy v4

i have changed : esp8266-512k-20191219-v1.11-671-g0d82f5d8c.bin
it's the same !!

Code: Select all

>>> exec(open('./chauf.mpy').read(),globals())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
SyntaxError: invalid syntax
>>> 
I don't know if I'm doing the right thing

Online
User avatar
Roberthh
Posts: 1959
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPycraft with mpy file

Post by Roberthh » Thu Dec 19, 2019 11:17 am

I updated mpy-cross.exe here https://github.com/robert-hh/Shared-Stuff to a today's build. Then it should match.

Christian Walther
Posts: 104
Joined: Fri Aug 19, 2016 11:55 am

Re: uPycraft with mpy file

Post by Christian Walther » Thu Dec 19, 2019 12:12 pm

I don’t think exec() takes mpy content. Have you tried running it using import chauf?

bellad
Posts: 52
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Thu Dec 19, 2019 12:28 pm

thank's , i will try mpy-cross

Christian , my prog chauf at wihle true , if i do import chauf , how to after for the start ?

bellad
Posts: 52
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Thu Dec 19, 2019 3:09 pm

hello Robert
i've updated with your myp-cross ,same
i think i idoes not do well
can you tell me how to ?
Attachments
myp.jpg
myp.jpg (58.47 KiB) Viewed 529 times

Online
User avatar
Roberthh
Posts: 1959
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPycraft with mpy file

Post by Roberthh » Thu Dec 19, 2019 3:15 pm

I agree to @Christian Walther, in that exec expects python source, not pre-compiled files.
At least,

import chauf

should run the file chauf.mpy.

bellad
Posts: 52
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Thu Dec 19, 2019 3:26 pm

ok , thank
i wil try with 'print' , because nothing is happening and I see nothing
i can't try with chauf.py because

Code: Select all

MemoryError: memory allocation failed, allocating %u bytes

Christian Walther
Posts: 104
Joined: Fri Aug 19, 2016 11:55 am

Re: uPycraft with mpy file

Post by Christian Walther » Thu Dec 19, 2019 9:36 pm

bellad wrote:
Thu Dec 19, 2019 12:28 pm
Christian , my prog chauf at wihle true , if i do import chauf , how to after for the start ?
I’m sorry, I don’t understand this sentence, can you rephrase? (Or – “chauf” sounds French – try in French?)

Post Reply