Replies: 5 comments 1 reply
-
+info: may-cross also compiled in RPi |
Beta Was this translation helpful? Give feedback.
-
Not quite sure what you mean. mpy files should run as long as the bytecode version is compatible with the interpreter. Small example on a Raspberry Pi Zero 2W (~ Pi 3, ish) using a freshly compiled MicroPython and mpy-cross: secrets.py: secrets = {
'ssid': 'thisone',
'password': "nope",
'hostname': "picow2",
} Compile and delete the source, leaving only
Now create mpytest.py: import secrets
print(secrets.secrets['hostname']) Run it:
|
Beta Was this translation helpful? Give feedback.
-
What I mean is: ubuntu@ubuntu:~$ cat x.py
print("it works!!!")
ubuntu@ubuntu:~$ mpy-cross x.py
ubuntu@ubuntu:~$ ls x.*
x.mpy x.py
ubuntu@ubuntu:~$ ls -lh x.*
-rw-r--r-- 1 ubuntu ubuntu 42 Sep 25 10:58 x.mpy
-rw-rw-r-- 1 ubuntu ubuntu 22 Sep 24 11:10 x.py
ubuntu@ubuntu:~$ micropython x.py
it works!!!
ubuntu@ubuntu:~$ micropython x.mpy
Traceback (most recent call last):
File "x.mpy", line 1
SyntaxError: invalid syntax
ubuntu@ubuntu:~$ Just to be sure, your example runs the |
Beta Was this translation helpful? Give feedback.
-
You can't run mpy files directly in any MicroPython interpreter |
Beta Was this translation helpful? Give feedback.
-
@Tangerino As a workaround, you can use $ micropython -c "import x" |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Dos mpy-cross supports RPi3/4 architectures?
Assuming MP was compiled and running in RPi, how do I compile the application sources py->mpy to run on these platforms?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions