View Issue Details

IDProjectCategoryView StatusLast Update
0001394FreeCADBugpublic2015-01-06 12:59
Reporterchilicuil Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
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/Simulation.py which outputs some warning due to using import on functions.

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

https://github.com/FreeCAD/FreeCAD_sf_master/blob/master/src/Mod/Ship/simRun/Simulation.py#L92

According to http://stackoverflow.com/questions/3571514/python-why-should-from-module-import-be-prohibited 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.

[0] https://bugs.launchpad.net/ubuntu/+source/freecad/+bug/1271768
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710481
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/Simulation.py is executed.
TagsNo tags attached.
FreeCAD Information

Activities

shoogen

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.

yorik

2014-02-09 15:42

administrator   ~0004175

That's one for sanguinariojoe I think...

wmayer

2015-01-06 12:52

administrator   ~0005536

This fixed since ~April 2014

7dc6f0ee2d9bfdc48a490082263d7869d407ec8a

Related Changesets

FreeCAD: master 7dc6f0ee

2014-04-29 09:50:04

Cercos-Pita J.L

Details Diff
Cleared the simulations stuff Affected Issues
0001394
mod - src/Mod/Ship/CMakeLists.txt Diff File
mod - src/Mod/Ship/Makefile.am Diff File
mod - src/Mod/Ship/ShipGui.py Diff File
rm - src/Mod/Ship/SimInstance.py Diff File
rm - src/Mod/Ship/simCreate/TaskPanel.py Diff File
rm - src/Mod/Ship/simCreate/TaskPanel.ui Diff File
rm - src/Mod/Ship/simCreate/__init__.py Diff File
rm - src/Mod/Ship/simPost/TaskPanel.py Diff File
rm - src/Mod/Ship/simPost/TaskPanel.ui Diff File
rm - src/Mod/Ship/simPost/__init__.py Diff File
rm - src/Mod/Ship/simRun/Sim/BEMsolver.py Diff File
rm - src/Mod/Ship/simRun/Sim/__init__.py Diff File
rm - src/Mod/Ship/simRun/Sim/computeSources.py Diff File
rm - src/Mod/Ship/simRun/Sim/evolution.py Diff File
rm - src/Mod/Ship/simRun/Sim/fsEvolution.py Diff File
rm - src/Mod/Ship/simRun/Sim/initialization.py Diff File
rm - src/Mod/Ship/simRun/Sim/matrixGen.py Diff File
rm - src/Mod/Ship/simRun/Simulation.py Diff File
rm - src/Mod/Ship/simRun/TaskPanel.py Diff File
rm - src/Mod/Ship/simRun/TaskPanel.ui Diff File
rm - src/Mod/Ship/simRun/__init__.py Diff File
rm - src/Mod/Ship/simRun/clSim/BEMsolver.py Diff File
rm - src/Mod/Ship/simRun/clSim/Utils.py Diff File
rm - src/Mod/Ship/simRun/clSim/__init__.py Diff File
rm - src/Mod/Ship/simRun/clSim/bem_jacobi_cl.py Diff File
rm - src/Mod/Ship/simRun/clSim/bem_lsqr_cl.py Diff File
rm - src/Mod/Ship/simRun/clSim/bem_minres_cl.py Diff File
rm - src/Mod/Ship/simRun/clSim/clUtils.py Diff File
rm - src/Mod/Ship/simRun/clSim/evolution.py Diff File
rm - src/Mod/Ship/simRun/clSim/initialization.py Diff File
rm - src/Mod/Ship/simRun/clSim/matrixGen.py Diff File
rm - src/Mod/Ship/simRun/theory/abstract.tex Diff File
rm - src/Mod/Ship/simRun/theory/bib.bib Diff File
rm - src/Mod/Ship/simRun/theory/deep_water.wxmx Diff File
rm - src/Mod/Ship/simRun/theory/images/CC_88x31.png Diff File
rm - src/Mod/Ship/simRun/theory/images/Integral.png Diff File
rm - src/Mod/Ship/simRun/theory/images/Integral.svg Diff File
rm - src/Mod/Ship/simRun/theory/images/Omega.png Diff File
rm - src/Mod/Ship/simRun/theory/images/Omega.svg Diff File
rm - src/Mod/Ship/simRun/theory/images/Omega2.png Diff File
rm - src/Mod/Ship/simRun/theory/images/Omega2.svg Diff File
rm - src/Mod/Ship/simRun/theory/images/test_bem.png Diff File
rm - src/Mod/Ship/simRun/theory/images/test_direct.png Diff File
rm - src/Mod/Ship/simRun/theory/images/test_wave.png Diff File
rm - src/Mod/Ship/simRun/theory/laplace2D.tex Diff File
rm - src/Mod/Ship/simRun/theory/laplace3D.tex Diff File
rm - src/Mod/Ship/simRun/theory/linearsystem.wxmx Diff File
rm - src/Mod/Ship/simRun/theory/main.aux Diff File
rm - src/Mod/Ship/simRun/theory/main.bbl Diff File
rm - src/Mod/Ship/simRun/theory/main.blg Diff File
rm - src/Mod/Ship/simRun/theory/main.log Diff File
rm - src/Mod/Ship/simRun/theory/main.out Diff File
rm - src/Mod/Ship/simRun/theory/main.pdf Diff File
rm - src/Mod/Ship/simRun/theory/main.tex Diff File
rm - src/Mod/Ship/simRun/theory/main.toc Diff File
rm - src/Mod/Ship/simRun/theory/test/green.py Diff File
rm - src/Mod/Ship/simRun/theory/test/main.py Diff File
rm - src/Mod/Ship/simRun/theory/test/waves.py Diff File
mod - src/WindowsInstaller/ModShip.wxi Diff File

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