maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
94 stars 46 forks source link

ModuleNotFoundError: No module named 'platformio.device.list.util'; 'platformio.device.list' is not a package: #15

Open not7cd opened 1 year ago

not7cd commented 1 year ago

I encountered error during upload on platformio-6.0.1 and ff76a3915224135aafad379817f41edd of this repo.

https://github.com/maxgerhardt/platform-raspberrypi/blob/fec7ed80ecfb4e3171a1c3c3748396763e54adc9/builder/main.py#L335

ModuleNotFoundError: No module named 'platformio.device.list.util'; 'platformio.device.list' is not a package:
  File "/nix/store/nyg508dcy96nvblv4jxw3m106lv6byxw-platformio-6.0.1/lib/python3.9/site-packages/platformio/builder/main.py", line 184:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/not7cd/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 602:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/not7cd/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 290:
    raise e
  File "/home/not7cd/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/not7cd/.platformio/platforms/raspberrypi@src-ff76a3915224135aafad379817f41edd/builder/main.py", line 337:
    from platformio.device.list.util import list_logical_devices

I was able to fix that by removing util, ended up with

from platformio.device.list import list_logical_devices

I will elaborate later, it's 3 AM here. Also, I would appreciate request for more data about environment. I use NixOS btw :sob:

not7cd commented 1 year ago

I think it would be smart to add a try...except statement for this import, to ease out the transition between versions. I'm unsure if this is a change from 6.1.x Also there is this https://github.com/platformio/platformio-core/blob/develop/platformio/public.py

not7cd commented 1 year ago

from platformio.public import list_logical_devices should be available in 6.1.6