esp8266_milight_hub: Cannot build with PlatformIO and Win10

Hi, i can build on Windows10 with PlatformIO. Python 3.7 is installed locally.

`
Processing nodemcuv2 (platform: espressif8266@~1.8; framework: arduino; board: nodemcuv2)

Verbose mode can be enabled via -v, --verbose option INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden. CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html PLATFORM: Espressif 8266 1.8.0 > NodeMCU 1.0 (ESP-12E Module)

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash PACKAGES: toolchain-xtensa 1.40802.0 (4.8.2), tool-esptool 1.413.0 (4.13), framework-arduinoespressif8266 2.20402.4 (2.4.2) Fatal Python error: initfsencoding: unable to load the file system codec File “c:\users\dsteingaesser.dl.platformio\penv\lib\encodings_init_.py”, line 123 raise CodecRegistryError,
^ SyntaxError: invalid syntax

Current thread 0x0000b474 (most recent call first): OSError: ‘python3 .get_version.py’ exited -1073740791: File “C:\users\dsteingaesser.dl.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 126:

env.SConscript("$BUILD_SCRIPT")

File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py”, line 541: return _SConscript(self.fs, *files, **subst_kw) File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py”, line 250: exec file in call_stack[-1].globals File “C:\users\dsteingaesser.dl.platformio\platforms\espressif8266@1.8.0\builder\main.py”, line 316: target_elf = env.BuildProgram() File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 224: return self.method(*nargs, **kwargs) File “C:\users\dsteingaesser.dl.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 107: env.ProcessFlags(env.get(“BUILD_FLAGS”)) File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 224: return self.method(*nargs, **kwargs) File “C:\users\dsteingaesser.dl.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 189: env.Append(**env.ParseFlagsExtended(flags)) File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 224: return self.method(*nargs, **kwargs) File “C:\users\dsteingaesser.dl.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 152: for key, value in env.ParseFlags(str(raw)).items(): File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 800: do_parse(arg) File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 676: arg = self.backtick(arg[1:]) File “C:\Users\dsteingaesser.DL.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 594: raise OSError(“‘%s’ exited %d” % (command, status)) ========================= [FAILED] Took 1.43 seconds ========================= `

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@dersch81 Did you solve your issue? Early versions of Python v3.7.2 had a distribution issue that exhibited the same behavior. The referred thread should give you some inputs to troubleshoot your issue. The File System codec is related to .pyc object files that are .py files pre-encoded using vcruntime140.dll for faster execution on Windows, and in that distribution this .dll occurred twice hence the error. Removing the .pyc files located in c:\users\dsteingaesser.dl.platformio\penv\Lib\site-packages\__pycache__ should temporary solve the problem but I suggest you a better solution that solved all my issues related to python.

  • close VSCode if a session is already running
  • make a backup of c:\users\dsteingaesser.dl.platformio and then remove this folder
  • launch VSCode IDE, it will reinstall latest PlatformIO and latest python v3.7 in a breeze.
  • make sure that no other python installation appears in the path variable, that would interfere.
  • if you need other packages inside PlatformIO, like pycurl, you’ll have to install them again with pip install ...
  • in a platformio Terminal test if python is running properly and try to build milight_hub again
  • if you don’t get better result or miss a functionality, then delete your .platformio folder again and restore it from the backup.

Under Windows, python3.exe doesn’t appear in .\platformio\python37 then the build of milight_hub will fail. You have 2 options,

  • Edit platformio.ini in the milight_hub project folder and replace !python3.exe with !python.exe because this last file exists then the system command preceded with ‘!’ will succeed. - or -
  • make a copy of .\platformio\python37\python.exe into python3.exe in the same folder, it should work the same but first option is better, even if you have to restore the hack after every update of the project.