Can any body help me? Today update Mac to Big Sur and get problem.
PlatformIO Core 5.0.3
Python 3.8.4-final.0
System Type darwin_x86_64
Platform macOS-10.16
File System Encoding utf-8
Locale Encoding UTF-8
PlatformIO Core Directory /Users/pc/.platformio
PlatformIO Core Executable /Users/pc/.platformio/penv/bin/platformio
Python Executable /Users/pc/.platformio/penv/bin/python
Global Libraries 10
Development Platforms 2
Tools & Toolchains 12
Traceback (most recent call last): File "/Users/pc/.platformio/packages/tool-esptoolpy/esptool.py", line 57, in <module> import serial.tools.list_ports as list_ports File "/Users/pc/.platformio/penv/lib/python3.8/site-packages/serial/tools/list_ports.py", line 29, in <module> from serial.tools.list_ports_posix import comports File "/Users/pc/.platformio/penv/lib/python3.8/site-packages/serial/tools/list_ports_posix.py", line 31, in <module> from serial.tools.list_ports_osx import comports File "/Users/pc/.platformio/penv/lib/python3.8/site-packages/serial/tools/list_ports_osx.py", line 32, in <module> kIOMasterPortDefault = ctypes.c_void_p.in_dll(iokit, "kIOMasterPortDefault") ValueError: dlsym(RTLD_DEFAULT, kIOMasterPortDefault): symbol not found
Fix: copy and replace esptool folder from IDE /Users/xxxxxxxxx/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools
to Platformio
/Users/xxxxxxxxx/.platformio/packages/tool-esptoolpy
@ivankravets I have tried your fix in a CLI env and is work just fine.
Previously I have tried the workaround mentioned by @oleksandr (esptoolpy update) and that worked too but apparently the root cause was pyserial not esptoolpy, right?
Have you tested this? The package JSON definitions of the Arduino core are not used by PlatformIO. These are being managed in their seperate package called tool-esptoolpy, with versions viewable at the bintray, with the latest package version containing esptoolpy 3.0.0, as opposed to the 3.0.0.2 in the PR. The above changes only the Arduino framework files for the core implementation.
@maxgerhardt now that you’ve pointed that the core is not used by PlatformIO, then I think you might be right. I tried various things late at night and remember that was the last action I took to get it working, but it looks like it was probably unrelated. Apologies for the misinformation. I think I might have got my ESP32 problems sorted by reinstalling Python from source via Homebrew and patching esptool.py to have a shebang line referencing Python3.
I fail to understand how updating esptool.py resolves the problem that the kIOMasterPortDefault symbol is not found which is triggered the pyserial library. Updating that folder only updates esptool.py, not pyserial.
Can you please do the following:
remove your /Users/<user>/.platformio/packages/tool-esptoolpy folder again
Aha okay. I see now the commit that works around the issue by suppressing the exception that is thrown in pyserial and not calling that function anymore. So indeed, it can be solved in multiple ways. By updating pyserial to the pre-release version as @ivankravetswrote above (which should be your preferred way of solving since it solves the root of the problem), by statically overwriting the contents of the folder /Users/<user>/.platformio/packages/tool-esptoolpy with the current version found at their github that has a workaround implemented, or by specifying per-project my above platform_packages line which is just the current esptool repo with a package.json to allow its usage in PlatformIO.