# PySerial and EspTools Directory Error

**URL:** <https://forum.arduino.cc/t/pyserial-and-esptools-directory-error/671804>\
**Category:** IDE 1.x\
**Created:** [August 26, 2020, 1:08am UTC](https://forum.arduino.cc/t/pyserial-and-esptools-directory-error/671804 "2020-08-26T01:08:20Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![juanssl](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@juanssl](https://forum.arduino.cc/u/juanssl)\
**Post date:** [November 13, 2020, 6:14am UTC](https://forum.arduino.cc/t/pyserial-and-esptools-directory-error/671804/5 "2020-11-13T06:14:58Z")

</div>

I updated my mac to macOS 11.0.1 Big Sur today and found the same problem.  
Instead of commenting the lines that **flszen** mentioned I fixed the source of the problem.

Context

- Arduino IDE version: 1.8.13
- esp8266 Core version: 2.7.4

My workaround is as follows:

1.- Open ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list\_ports\_osx.py  
2.- Comment out lines **29** and **30** and append 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 like this:

```cpp
#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')

```

This is the same fix that the developers of pyserial made ([Latest version of the file here](https://github.com/pyserial/pyserial/blob/master/serial/tools/list_ports_osx.py)) to fix this issue but the esp8266 core uses a 2 year old version of pyserial, so until they update the library this will still be an issue.

---

_[View the full topic](https://forum.arduino.cc/t/pyserial-and-esptools-directory-error/671804)._
