8000 mimxrt boot automounts sd card without adding /lib to path, breaking imports · Issue #15647 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
mimxrt boot automounts sd card without adding /lib to path, breaking imports #15647
Open
@allieum

Description

@allieum

Port, board and/or hardware

mimxrt, teensy 4.1

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Teensy 4.1 with MIMXRT1062DVJ6A

Reproduction

in

sys.path.append("/sdcard")
an sd card is automounted to /sdcard and then os.chdir makes this the working directory. However, /sdcard/lib is not added to the import paths so code located there will not be found by import statements.

Ran into this when using the mpr xrun tool, because the underlying mpremote commands work relative to the working directory, ended up in a state where .mpy files are copied over to /sdcard/lib but the when the program runs it can't find them.

Expected behaviour

Not sure the appropriate behavior here, but the issue would maybe have been avoided if either

  1. /sdcard/lib were added to the path, like /flash/lib is a few lines above, or
  2. if there were no os.chdir to the automounted sd card. this would allow mpr/mpremote to continue to use /flash as working directory, per usual without breaking the handy mpr xrun command. I hadn't initially expected that /sdcard would become the working directory which caused confusion in tracking down this behavior.

as a workaround I am using the functionality where creating the file /flash/SKIPSD skips the SD card auto-mount.

Observed behaviour

n/a

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0