"from freecad import app" everywhere

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
galou_breizh
Posts: 436
Joined: Wed Sep 15, 2010 9:38 am

"from freecad import app" everywhere

Post by galou_breizh »

It looks that some users cannot do "from freecad import app". I know some windows users for which is is the case, cf. https://forum.freecadweb.org/viewtopic. ... 36#p280485.

I don't have problems with it on Ubuntu:
OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15592 (Git)
Build type: Release
Branch: master
Hash: a7c0f4bc5b62ec304a5855796ca3d10a42c7a46e
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

I though that "from freecad import app" was the way to go because it is more pythonic and that the changes associated to the possibility to import "app" from module "freecad" also allowed to install add-ons with pip.

There should be only one way to import freecad modules and it should work everywhere. Of course, I would prefer "from freecad import app" as you understood.

Thanks for any feedback, especially on other operating systems.
Gaël
galou_breizh
Posts: 436
Joined: Wed Sep 15, 2010 9:38 am

Re: "from freecad import app" everywhere

Post by galou_breizh »

Any reaction or decision on this?
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: "from freecad import app" everywhere

Post by triplus »

For existing macros i am guessing:

Code: Select all

import FreeCAD as App
Should do.

P.S. Using the new import style, porting the existing macros, would lead to things like dropping FreeCAD 0.16 support and investing effort with little benefit in return. As for the new macros, that do want to use the new import style. Or i guess if somebody wants to make a macro available with pip. I agree there should be a straightforward guideline on what to use, and that should work everywhere.
Post Reply