Skip to content
Discussion options

You must be logged in to vote

Suppose you have a script "test.py" in the "/tmp" directory, as shown below:

import sys
print(sys.platform)
print(arg1, arg2, arg1+arg2)

Doing this in a terminal in the "/tmp" directory:

$ cd /tmp
$ mpremote u0 mount . exec "arg1=1; arg2=3" run test.py
Local directory . is mounted at /remote
esp32
1 3 4

will mount the current working directory ("/tmp"), set the arg1 and arg2 values using exec, load and run the "test.py" script from RAM on your esp32 board.

Another alternative, which I prefer is to create two scripts in e.g. "/tmp" directory:

# args.py
arg1=1
arg2=3

and

#test1.py
from args import *
import sys
print(sys.platform)
print(arg1, arg2, arg1+arg2)

Then, from a terminal in any di…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@picpic020960
Comment options

Answer selected by picpic020960
Comment options

You must be logged in to vote
3 replies
@picpic020960
Comment options

@shariltumin
Comment options

@andrewleech
Comment options

andrewleech Aug 13, 2024
Collaborator Sponsor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants