platformio / platform-atmelmegaavr

Atmel megaAVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelmegaavr
Apache License 2.0
29 stars 22 forks source link

socket.py import error DLL load failed (DxCore) #47

Closed mikrocoder closed 2 years ago

mikrocoder commented 2 years ago

Hello,

I have a fresh PlatformIO installation with current DxCore 1.4.10 and would like to transfer a blink test via USB. USB > FTDI232RL > Bootloader > USART Controller.

pymcuprog I have installed after. The error is fixed. Python 3.10.6 is also fresh installed.

But now socket.py is not found. But the file is present in the path. What to do?

platformio.ini

[platformio]
default_envs = Upload_USB

[env]
platform = atmelmegaavr
framework = arduino
board = AVR128DB64

[env:Upload_USB]
upload_protocol = custom
upload_command = pymcuprog erase && pymcuprog write -f $SOURCE

Output:

Executing task in folder DxCoreAVR128DB64_001: C:\Users\Worker\.platformio\penv\Scripts\platformio.exe run --target upload --environment Upload_USB 

Processing Upload_USB (platform: atmelmegaavr; framework: arduino; board: AVR128DB64)
----------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/AVR128DB64.html
PLATFORM: Atmel megaAVR (1.6.0) > AVR128DB64     
HARDWARE: AVR128DB64 24MHz, 16KB RAM, 128KB Flash
PACKAGES:
 - framework-arduino-megaavr-dxcore @ 1.4.10     
 - tool-avrdude-megaavr @ 3.60300.220118 (6.3.0) 
 - toolchain-atmelavr @ 3.70300.220127 (7.3.0)   
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 17 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SPI @ 1.0.2 
|-- Wire @ 2.0.6
Building in release mode
Compiling .pio\build\Upload_USB\src\main.cpp.o
Compiling .pio\build\Upload_USB\libe1e\SPI\SPI.cpp.o
Compiling .pio\build\Upload_USB\lib8e9\Wire\Wire.cpp.o
Compiling .pio\build\Upload_USB\lib8e9\Wire\twi.c.o
Compiling .pio\build\Upload_USB\lib8e9\Wire\twi_pins.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\UART.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\UART0.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\UART1.cpp.o
Archiving .pio\build\Upload_USB\libe1e\libSPI.a
Compiling .pio\build\Upload_USB\FrameworkArduino\UART2.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\UART3.cpp.o
Archiving .pio\build\Upload_USB\lib8e9\libWire.a
Compiling .pio\build\Upload_USB\FrameworkArduino\UART4.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\UART5.cpp.o
Indexing .pio\build\Upload_USB\libe1e\libSPI.a
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts.c.o
Indexing .pio\build\Upload_USB\lib8e9\libWire.a
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PA.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PB.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PC.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PD.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PE.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PF.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WInterrupts_PG.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\abi.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\Common.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\IPAddress.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\PluggableUSB.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\Print.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\RingBuffer.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\Stream.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\api\String.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\hooks.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\main.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\new.cpp.o
Compiling .pio\build\Upload_USB\FrameworkArduino\pinswap.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\Upload_USB\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\Upload_USB\libFrameworkArduino.a
Indexing .pio\build\Upload_USB\libFrameworkArduino.a
Linking .pio\build\Upload_USB\firmware.elf
Checking size .pio\build\Upload_USB\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.2% (used 367 bytes from 16384 bytes)
Flash: [          ]   2.1% (used 2794 bytes from 131072 bytes)
Building .pio\build\Upload_USB\firmware.hex
Configuring upload protocol...
AVAILABLE: custom
CURRENT: upload_protocol = custom
Uploading .pio\build\Upload_USB\firmware.hex
Traceback (most recent call last):
  File "C:\Users\Worker\.platformio\python3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Worker\.platformio\python3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Worker\AppData\Local\Programs\Python\Python310\Scripts\pymcuprog.exe\__main__.py", line 4, in <module>
  File "C:\Users\Worker\AppData\Local\Programs\Python\Python310\lib\site-packages\pymcuprog\pymcuprog.py", line 
12, in <module>
    from logging.config import dictConfig
  File "C:\Users\Worker\.platformio\python3\lib\logging\config.py", line 30, in <module>
    import logging.handlers
  File "C:\Users\Worker\.platformio\python3\lib\logging\handlers.py", line 26, in <module>
    import logging, socket, os, pickle, struct, time, re
  File "C:\Users\Worker\.platformio\python3\lib\socket.py", line 51, in <module>
    import _socket
ImportError: DLL load failed while importing _socket: Das angegebene Modul wurde nicht gefunden.
*** [upload] Error 1
========================================== [FAILED] Took 4.68 seconds ==========================================
Environment    Status    Duration
-------------  --------  ------------
Upload_USB     FAILED    00:00:04.677
==================================== 1 failed, 0 succeeded in 00:00:04.677 ==================================== 
mikrocoder commented 2 years ago

The solution is here: https://github.com/platformio/platform-atmelmegaavr/issues/41