1

I'm new to pyqgis so I may be headed in the wrong direction on this. I imported qgis on python consolde in qgis, no problem. However when I try to do this in PythonWin, I get an error saying the module does not exist. I tried os.listdir for all folders where QGIS is installed and can't find the module anywhere. Need to write a stand alone script in a batch process so I can't use the QGIS python console. Is there something I'm missing?

Here is import from QGIS console:

    import qgis
    help(qgis)
    Help on package qgis:

    NAME
        qgis

    FILE
        c:\progra~2\qgis2~1.14\apps\qgis-ltr\python\qgis\__init__.py

    DESCRIPTION...

and here is the error from PythonWin:

import qgis
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named qgis
  • Do you have more than one version of Python installed? For me using Pycharm on Linux (works on Windows too) I need to have Python 2.7 as the interpreter, rather than my python version 3+ – nmtoken Mar 2 '17 at 8:33
  • @nmtoken I ran os.listdir() in program files where both ArcGIS and QGIS are installed. Python 2.7 was initially installed with ArcMap and I don't see another version anywhere else in program files. – geoJshaun Mar 2 '17 at 17:16
  • @geoJshaun did you find the answer? this is where I'm stuck for days! Best wishes. – Afshin Salehi Sep 29 at 17:06
  • @AfshinSalehi No, I never did unfortunately – geoJshaun Oct 5 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.