I am trying to build a custom Marlin for Makerbase Robin E3 board. I got the firmware from the makers and I am having trouble building.
In PlatformIO, I am getting this error.
NameError: name ‘env’ is not defined:
File “C:\Users\jthrasher.platformio\penv\Lib\site-packages\platformio\builder\main.py”, line 180:
env.SConscript(env.GetExtraScripts(“post”), exports=“env”)
File “C:\Users\jthrasher.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py”, line 598:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\jthrasher.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py”, line 285:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\jthrasher\Downloads\MKS ROBIN E3+ TFT35-FW\MKS ROBIN E3+ TFT35-FW\MKS_Marlin-2.0.6.1_for_ender3_TMC2209\Marlin-2.0.6.1_for_ender3_TMC2209\buildroot\share\PlatformIO\scripts\mks_robin_e3.py”, line 6:
for define in env[‘CPPDEFINES’]:
In the IDE, env is showing as not defined.
There is an Import for it:
from ast import Import ← I added this to resolve an error with Import.
import os
Import(“env”)
I am not sure where to go from here. Please let me know if I can provide additional information.
No. The red squiggles in this script mean nothing because it cannot dynamically resolve the Scons Import() function. Adding in the Import function from the ast pacakge is wrong, you should undo that change.
You’re attempting to compile an older Marlin version likely with PlatformIO core 6, which does not have needed backpatch
Sorry. Thought that was a random hyperlink.
PlatformIO Core 6.1.10
Python 3.11.4-final.0
System Type windows_amd64
Platform Windows-10
File System Encoding utf-8
Locale Encoding cp1252
PlatformIO Core Directory C:\Users\jthrasher.platformio
PlatformIO Core Executable C:\Users\jthrasher.platformio\penv\Scripts\platformio.exe
Python Executable C:\Users\jthrasher.platformio\penv\Scripts\python.exe
Global Libraries 0
Development Platforms 1
Tools & Toolchains 5