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.

Submitter:  - <_90458>
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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']


- <_90458>

 

(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 _90458 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-f8d8.
    Corresponding source code