View Issue Details

IDProjectCategoryView StatusLast Update
0001394FreeCADBugpublic2015-01-06 12:59
ReporterchilicuilAssigned Towmayer 
Status closedResolutionfixed 
Product Version0.13 
Target VersionFixed in Version0.14 
Summary0001394: Python imports used on functions output warnings on Debian|Ubuntu installations
DescriptionOn Debian|Ubuntu the installation process execute /usr/lib/freecad/Mod/Ship/simRun/ which outputs some warning due to using import on functions.

 SyntaxWarning: import * only allowed at module level
  def run(self):

According to this restriction was introduced in Python 2.1, as a consequence of the "Nested Scopes" feature (PEP 227), quoting:

One side effect of the change is that the from module import * and exec statements have been made illegal inside a function scope under certain conditions. The Python reference manual has said all along that from module import * is only legal at the top level of a module, but the CPython interpreter has never enforced this before. As part of the implementation of nested scopes, the compiler which turns Python source into bytecodes has to generate different code to access variables in a containing scope. from module import * and exec make it impossible for the compiler to figure this out, because they add names to the local namespace that are unknowable at compile time. Therefore, if a function contains function definitions or lambda expressions with free variables, the compiler will flag this by raising a SyntaxError exception.

Steps To ReproduceI'm not sure in which way Freecad is called during the configuration phase. However it seems that at least the /usr/lib/freecad/Mod/Ship/simRun/ is executed.
TagsNo tags attached.



2014-02-09 09:07

developer   ~0004174

the install debian/ubuntu install scripts try to compile .py to .pyc files. This makes some sense as the ordinary user won't have sufficient rights to compile them at the time of the first run.


2014-02-09 15:42

administrator   ~0004175

That's one for sanguinariojoe I think...


2015-01-06 12:52

administrator   ~0005536

This fixed since ~April 2014


Issue History

Date Modified Username Field Change
2014-02-09 08:34 chilicuil New Issue
2014-02-09 09:07 shoogen Note Added: 0004174
2014-02-09 15:42 yorik Assigned To => user701
2014-02-09 15:42 yorik Status new => assigned
2014-02-09 15:42 yorik Note Added: 0004175
2015-01-06 12:52 wmayer Note Added: 0005536
2015-01-06 12:52 wmayer Status assigned => closed
2015-01-06 12:52 wmayer Resolution open => fixed
2015-01-06 12:52 wmayer Fixed in Version => 0.14
2015-01-06 12:57 shoogen Changeset attached => FreeCAD Master master 5229e546
2015-01-06 12:58 shoogen Changeset attached => FreeCAD Master master 7dc6f0ee
2015-01-06 12:58 shoogen Assigned To user701 =>
2015-01-06 12:58 shoogen Status closed => feedback
2015-01-06 12:58 shoogen Resolution fixed => reopened
2015-01-06 12:59 shoogen Changeset removed FreeCAD Master master 5229e546 =>
2015-01-06 12:59 shoogen Status feedback => closed
2015-01-06 12:59 shoogen Assigned To => wmayer
2015-01-06 12:59 shoogen Resolution reopened => fixed