Error Running AddOnManager in 018.15052

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Syres
Posts: 286
Joined: Thu Aug 09, 2018 11:14 am

Error Running AddOnManager in 018.15052

Postby Syres » Sat Oct 27, 2018 11:29 am

I noticed there was a recent PR https://github.com/FreeCAD/FreeCAD/pull/1740 which shows as Closed. Using both of the following versions, I'm getting the error received below in Report View when trying to start the Addon manager. I was just wondering whether this is still being worked on/actioned? By all means confirm on other platforms and just to note all the Python files quoted below are present.

Code: Select all

Running the Python command 'Std_AddonMgr' failed:
Traceback (most recent call last):
  File "E:\Data\My Downloads\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\Mod\AddonManager\AddonManagerGui.py", line 10, in Activated
    import AddonManager
  File "E:\Data\My Downloads\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\Mod\AddonManager\AddonManager.py", line 54, in <module>
    from addonmanager_macro import Macro
  File "E:\Data\My Downloads\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\FreeCAD_0.18.15052_Conda_Py3QT5-WinVS2015_x64\Mod\AddonManager\addonmanager_macro.py", line 28, in <module>
    from freecad import app

cannot import name 'app'

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15052 (Git)
Build type: Release
Branch: master
Hash: 76590be8aca6b4fed09ec94ada811fa89dbcdbe0
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedKingdom (en_GB)

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15052 (Git)
Build type: Release
Branch: master
Hash: 76590be8aca6b4fed09ec94ada811fa89dbcdbe0
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
User avatar
Kunda1
Posts: 4778
Joined: Thu Jan 05, 2017 9:03 pm

Re: Error Running AddOnManager in 018.15052

Postby Kunda1 » Sat Oct 27, 2018 12:57 pm

galou wrote:
@galou ping
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wmayer
Site Admin
Posts: 14442
Joined: Thu Feb 19, 2009 10:32 am

Re: Error Running AddOnManager in 018.15052

Postby wmayer » Sat Oct 27, 2018 2:11 pm

I think this is a problem of the AppImage where presumably the freecad directory isn't picked up.

But there is also regression in the PR because it has removed the function get_macro_dir() and replaced its occurrences with FreeCAD.getUserMacroDir(). However, FreeCAD.getUserMacroDir() only returns the path of the default macro directory but not the path of the actual macro directory which a user can change in the preferences/macro dialog.
User avatar
sgrogan
Posts: 5204
Joined: Wed Oct 22, 2014 5:02 pm

Re: Error Running AddOnManager in 018.15052

Postby sgrogan » Sat Oct 27, 2018 2:58 pm

Syres wrote:
Sat Oct 27, 2018 11:29 am
By all means confirm on other platforms
Works for me, with only the problem wmayer pointed out.

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15052 (Git)
Build type: Release
Branch: master
Hash: 76590be8aca6b4fed09ec94ada811fa89dbcdbe0
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
User avatar
yorik
Site Admin
Posts: 11385
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Error Running AddOnManager in 018.15052

Postby yorik » Sat Oct 27, 2018 7:17 pm

I fixed the "from freecad import app" issue in git commit 57726db47
wmayer wrote:
Sat Oct 27, 2018 2:11 pm
However, FreeCAD.getUserMacroDir() only returns the path of the default macro directory but not the path of the actual macro directory which a user can change in the preferences/macro dialog.
Shouldn't we change that? Not sure...
wmayer
Site Admin
Posts: 14442
Joined: Thu Feb 19, 2009 10:32 am

Re: Error Running AddOnManager in 018.15052

Postby wmayer » Sat Oct 27, 2018 7:26 pm

yorik wrote:
Sat Oct 27, 2018 7:17 pm
I fixed the "from freecad import app" issue in git commit 57726db47
wmayer wrote:
Sat Oct 27, 2018 2:11 pm
However, FreeCAD.getUserMacroDir() only returns the path of the default macro directory but not the path of the actual macro directory which a user can change in the preferences/macro dialog.
Shouldn't we change that? Not sure...
Yes, makes sense as FreeCAD.getUserMacroDir() is quite useless if the user has changed the default path. We could also add an optional parameter to the function and depending on it return the actual or current path.
wmayer
Site Admin
Posts: 14442
Joined: Thu Feb 19, 2009 10:32 am

Re: Error Running AddOnManager in 018.15052

Postby wmayer » Sun Oct 28, 2018 4:10 pm

User avatar
yorik
Site Admin
Posts: 11385
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Error Running AddOnManager in 018.15052

Postby yorik » Sun Oct 28, 2018 4:18 pm

Thanks!
galou_breizh
Posts: 252
Joined: Wed Sep 15, 2010 9:38 am

Re: Error Running AddOnManager in 018.15052

Postby galou_breizh » Thu Nov 08, 2018 3:55 pm

yorik wrote:
Sat Oct 27, 2018 7:17 pm
I fixed the "from freecad import app" issue in git commit 57726db47
I think this is not a fix, this is a workaround because `from freecad import app` is a more modern version of `import FreeCAD`. Moreover, `from freecad import app` works on v0.18 with Python 2.
yorik wrote:
Sat Oct 27, 2018 7:17 pm
Shouldn't we change that? Not sure...
As I wrote (https://github.com/FreeCAD/FreeCAD/commit/17c783051), I would rather have `FreeCAD.getUserMacroDir()` return the actual path and `FreeCAD.getUserMacroDir(False)` return the default path.

Gaël