looo wrote:first try fails (python3):
Code: Select all
Error in FreeCADGuiInit.py: Parent module 'freecad.modules.Arch' not loaded, cannot perform relative import
Traceback (most recent call last):
File "<string>", line 158, in <module>
File "<string>", line 142, in InitApplications
File "/home/lo/anaconda/envs/freecad/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 981, in _gcd_import
File "<frozen importlib._bootstrap>", line 931, in _sanity_check
<class 'SystemError'>: Parent module 'freecad.modules.Arch' not loaded, cannot perform relative import
Thanks for the pointer, I haven't tried this branch or FreeCAD in general with Python 3 yet, I thought it didn't work with Python3 yet.
All the testing I've done has been with Python 2.
I'll fix this one though, makes obviously more sense to make sure that new code is Python 3 compatible.
[edit] Should be fixed now
Also, regarding the imports, yes there will be more letters/words because you lose some magic, but as suggested if you really want to have simplified aliases available you can still add that in multiple ways. Both the automatic import on workbench activation as well as a user configurable option using
PYTHONSTARTUP sound like good suggestions.
Also the REPL in FreeCAD GUI already support tab completion [edit] Just noticed this doesn't work for imports for some reason
[/edit]
The command line one doesn't, but integrating something like ptpython should be
pretty straightforward.
looo wrote:thanks, currently building.
simonvanderveldt wrote:One thing I did run into was this error when starting the Arch workbench
This isn't a big problem. Removing the magic parts from FreeCAD will really help people understand the code. And function which work without import are quite magic
This could become annoying though if there a modules that use this extensively. Ideally the logging shouldn't work with aliased/global values like this, but just use Python's native logging API, but that's something for another time
I think such things can only occur in Init.py and InitGui.py.
You're right, I only found this in Arch's GUI init, fixed it by making the imports explicit