Bug report #18658

PyQGIS Developer Cookbook and the modules

Added by Moritz Langer almost 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Documentation and Help
Affected QGIS version:3.0.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:26546

Description

Dear members of QGIS,

first of all I want to thank you big time for the efforts you made, make and will make by providing QGIS and keeping it under the open source license. That is really appreciated and an huge benefit to all kinds of people.

Scince this is the first time I´m writing a bug ticket I hope it might help and its not total nonsense or it hasn´t been reported.
Another thing you might want to consider is that I´m a stranger to Python and just started learning so it might be possible that its just my mistake or missing knowledge and not an error itself.

So here´s the "problem":

I just peaked into the PyQGIS Developer Cookbook and because of the general interest in Network Analysis and especially in creating Service Areas I scrolled down and tried to just copy and paste the code into the Qgis Python Console.
I didn´t expect it to run through and create an output right away but I was curious nonetheless.
What I didn´t expect is that the problem occurred in the first lines of code where you just import modules.

"from qgis.networkanalysis import *
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 664, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'qgis.networkanalysis'"

Thats a copy of the error message. I also tried to import the module or class using several other statements, for example:

"from qgis.analysis import network
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
ImportError: cannot import name 'network'"

As I said, please consider that I´m new to ticket writing and python itself...

Yet I still hope that this might be some kind of hint or help if there is a bug. If there isn´t its even better :)

Have a good day and thank you for providing QGIS.
Best regards from Germany

History

#1 Updated by Tudor Bărăscu almost 6 years ago

Hi, the cookbook is not fully updated to QGIS 3. The effort of updating it is made by volunteers so.. you'll just have to wait, figure it out for yourself and maybe contribute or pay somebody to teach you or to update the cookbook.
All the best!

#2 Updated by Alexander Bruy almost 6 years ago

  • Resolution set to invalid
  • Operating System deleted (Windows 10)
  • Status changed from Open to Closed
  • Category changed from PyQGIS Console to Documentation and Help

Please file documenation related issues in the corresponding bugtracker https://github.com/qgis/QGIS-Documentation/issues

Also available in: Atom PDF