[Qgis-developer] Difference of "import" inside qgis python console and inside a python plugin

Luca Mandolesi mandoluca at gmail.com
Thu Apr 2 15:36:44 PDT 2015


Hi to all,

I'm trying to use vispy module inside my python plugin, but a strange thing
happens:

If I call import vispy inside the Qgis python console the script runs
properly, but, if I put the "import vispy", at the beginning of my plugin,
I receive this error [0]

Why inside the Qgis python console a module can be imported, but not inside
a plugin?

Really, really, strange.

Ideas?

Thanks a lot,
Luca



[0]
Traceback (most recent call last):
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 219, in
startPlugin
    plugins[packageName] = package.classFactory(iface)
  File
"C:\Users\Windows\Github\pyarchinit_beta_test_dev\pyarchinit\__init__.py",
line 49, in classFactory
    from pyarchinit_plugin import PyArchInitPlugin
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\Users\Windows\Github\pyarchinit_beta_test_dev\pyarchinit\pyarchinit_plugin.py",
line 23, in
    import vispy as visp
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File
"C:\OSGeo4W\apps\Python27\lib\site-packages\vispy-0.3.0-py2.7.egg\vispy\__init__.py",
line 34, in
    _parse_command_line_arguments()
  File
"C:\OSGeo4W\apps\Python27\lib\site-packages\vispy-0.3.0-py2.7.egg\vispy\util\config.py",
line 275, in _parse_command_line_arguments
    opts, args = getopt.getopt(sys.argv[1:], '', argnames)

AttributeError: 'module' object has no attribute 'argv'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150403/ebf0c666/attachment.html>


More information about the Qgis-developer mailing list