ValueError: incompatible .mpy file

Hello,

I am following the Digi Micropython Programming guide documentation to setup my development environment with PyCharm IDE and the Digi XBee plugin.

The setup works great and I was able to create a project, add some code and have the IDE flash the connected module.
However when the code runs, I get the following error on the terminal:

MicroPython v1.11-1227-g52e306b on 2019-07-10; XBee3 Zigbee with EFR32MG
Type “help()” for more information.
>>>
Loading /flash/main.mpy…
ValueError: incompatible .mpy file

If I download the same code directly from the terminal using (CTRL+F / CRTL+D) and then run it using CTRL+R
then it executes the mpy just fine.

I am using PyCharm version 2019.1.3 and Xbee plugin Version 1.0.1 (June 2019). The Xbee3 Zigbee module I am using is on f/w 1007

I am suspecting that the plugin is using a version of the cross-compiler that is not compatible with the micropython installed on the module, but I have no idea how/where I can change the cross-compiler.

Any help is appreciated. The PyCharm IDE + Plugin is quite amazing to use and this is really the only problem right now to get a full development environment setup.

Thanks,
Amir.

Hi Amir,

Thanks for reporting this issue. As you say, there is a mismatch between the cross-compiler and MicroPython versions. We are fixing the problem and will release a new version of the plugin very soon.

In the meantime, you can disable the source compilation to avoid this problem. To do so, go to File | Settings | Project: | XBee MicroPython and uncheck the “Compile source files with ‘mpy-cross’” option.

We apologize for the inconvenience.

Best regards,
Ruben

1 Like

This error occurs when importing a module that is stored as a mpy binary file (rather than a py text file) that was generated by a different version of CircuitPython than the one its being loaded into. Most versions are compatible but, rarely they aren’t.

ValueError: Incompatible .mpy file.
This error occurs when importing a module that is stored as a mpy binary file (rather than a py text file) that was generated by a different version of CircuitPython than the one its being loaded into. Most versions are compatible but, rarely they aren’t.This may help:
https://docsbay.net/troubleshooting