Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] macOS - Aruino IDE - How to fix "pyserial or esptool directories not found next to this upload.py tool" error (ESP8266)
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2796
Topic starter
March 2, 2021 6:43 AM
When switching to Big Sur, somehow the ESP8266 tools for the Arduino IDE broke ... and one cannot upload compiled sketches any more.
An example of this error:
pyserial or esptool directories not found next to this upload.py tool.
An error occurred while uploading the sketch
This affects at least ESP8266 Core version 2.7.4 and 2.7.2 (I'm running Arduino IDE version: 1.8.13 right now).
The fix:
- Open the file
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list_ports_osx.py
- Comment out lines 29 and 30 and add these lines:
iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
The code should look something like this, save it and try again ... this fixed it on my Mac:
from serial.tools import list_ports_common
#iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
#cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
kIOMasterPortDefault = ctypes.c_void_p.in_dll(iokit, "kIOMasterPortDefault")
kCFAllocatorDefault = ctypes.c_void_p.in_dll(cf, "kCFAllocatorDefault")
(@Anonymous)
Joined: 1 second ago
Posts: 0
May 11, 2021 12:19 AM
Very useful,
It worked for me (iMAC BIG SUR).
thanks for sharing