1

A long-distance friend created a little script for me to eventually be a plug-in inside QGIS. But we want to try it as a stand-alone first to test and fix bugs. He created it on a Linux machine (if that makes any difference). When I try to run it on my Windows 7 64 using Python 2.7 I always get the

"ImportError: No module named qgis.core"

For days I have read up about this issue and to my best tried what was suggested on all those posts. It seems I just have to set my variable paths correctly but have had no luck. I have tried, for example various combinations (and all) the following paths:

"C:\OSGeo4W64\bin;"
"C:\OSGeo4W64\apps\qgis\python\qgis;"
"C:\OSGeo4W64\apps\qgis\python\qgis\core;"
"C:\Toolbox\QGIS\apps\Python27\Lib;"
"C:\Toolbox\QGIS\apps\Python27\Lib\site-packages;"
"C:\Toolbox\QGIS\apps\Python27\Lib\importlib;"
"C:\Toolbox\QGIS\apps\Python27\Lib\distutils;"
"C:\Toolbox\QGIS\apps\qgis\bin;"
"C:\Toolbox\QGIS\apps\qgis\python;"
"C:\Toolbox\QGIS\apps\qgis\python\plugins;"
"C:\Toolbox\QGIS\apps\qgis\python\qgis;"
"C:\Toolbox\QGIS\apps\qgis\python\qgis\core;"
"C:\Toolbox\QGIS\apps\qgis\python\qgis\gui;"
"C:\Toolbox\QGIS\apps\qgis\python\qgis\PyQt"

I first installed QGIS Esson (latest version) and tried running Python thru that. Then I tried a separate Python install. Now I tried an OSGeo464 installion with Python inside that. Always the same error.

My friend sent me a different version that comments out the need for qgis.core showing just a simple UI and that script works OK so I would think my paths are working? (at least the gui-core?).

Can someone with patience please walk a "non-coder" thru this issue. I would be soooo grateful as I am not sure what to try next.

Selcuk
  • 57,004
  • 12
  • 102
  • 110
Clutch
  • 89
  • 1
  • 7
  • Is the file you are running this code in named `qgis.py` by chance? Is so, this is a duplicate of [this question](https://stackoverflow.com/questions/36250353/importing-installed-package-from-script-raises-attributeerror-module-has-no-at) – pppery Jun 26 '16 at 15:36
  • No, it has a different name. I also tried a simple test script I found. It also gave the same error message, thinking maybe it was the script itself was the issue but no it must be my set up. – Clutch Jun 27 '16 at 14:23
  • Is there another file in the directory you are running your code in named `qgis.py`? – pppery Jun 27 '16 at 14:24
  • No,... nothing called qgis.py. I created a folder and have two files and named them fpm.py (this one works showing a GUI)., and fpm1.py which is the one throwing the qgis.core error. – Clutch Jun 27 '16 at 15:57

0 Answers0