bugpyFormex - Bugs: bug #54787, Importing vtk_itf from command...

 
 

bug #54787: Importing vtk_itf from command line results in AttributeError due to missing "vtk" option.

Submitted by:  Tim Dezutter <tdezutter>
Submitted on:  Fri 05 Oct 2018 08:25:01 AM UTC  
 
Category:  Plugins Severity:  2 - Minor
Item Group:  Functionality error Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 05 Oct 2018 09:11:14 AM UTC, comment #1: 

When you import pyFormex in a Python session, you do not get all the pyFormex initialization as when running the pyformex command.
In particular, you are missing the pyformex.options.
Therefore the proper way to immport pyFOrmex is to fully initialize it after import, by calling the pyformex.run() command.
You can pass a list of pyformex command options as argument to the run function. See the example below.

import pyformex as pf
pf.run(['--nogui', '--vtk=default'])
from pyformex.plugins import vtk_itf

Benedict Verhegghe <bverheg>
Project Administrator
Fri 05 Oct 2018 08:25:01 AM UTC, original submission:  

Importing the "vtk_itf" plugin when pyFormex is used as an external package (i.e. you don't run pyFormex as a program, but import it in another Python script or application) results in an AttributeError due to a missing "vtk" attribute in pf.options.

To reproduce the error, launch a Python shell in a terminal and execute the following commands (output from my execution is included):

>>> import pyformex as pf  ## If needed, first set pyFormex root directory at the start of sys.path.
>>> pf.__version__
'1.0.5-a1'
>>> from pyformex.plugins import vtk_itf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path_to_pyformex/pyformex/plugins/vtk_itf.py", line 68, in <module>
    if VTK_VERSION.split('.')[0] >= 6 and pf.options.vtk != 'standard':
AttributeError: class options has no attribute 'vtk'
>>> dir(pf.options)
['__doc__', '__module__', 'debuglevel', 'uselib']

Tim Dezutter <tdezutter>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by tdezutter (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-20 bverheg StatusNone => Wont Fix
        Open/ClosedOpen => Closed
    2018-10-05 bverheg Severity3 - Normal => 2 - Minor

    Back to the top


    Powered by Savane 3.5