I run myscript and get this error:

from qgis.core import * # @UnusedWildImport
from qgis.gui import * # @UnusedWildImport
from PyQt4.QtCore import * # @UnusedWildImport
from PyQt4.QtGui import * # @UnusedWildImport
# Import the code for the dialog
from delineationdialog import DelineationDialog
***(code continues)***

Error is:

Traceback (most recent call last):
  File "C:/Program Files/QGIS 2.18/apps/qgis/python/plugins/HidroTurk/HT_HJK/delineation.py", line 28, in <module>
    from delineationdialog import DelineationDialog
  File "C:\Program Files\QGIS 2.18\apps\qgis\python\plugins\HidroTurk\HT_HJK\delineationdialog.py", line 24, in <module>
    from ..UIs.ui_delineation import Ui_QgsOptionsBase
ValueError: Attempted relative import in non-package

here is the DelineationDialog:

from PyQt4 import QtGui
from ..UIs.ui_delineation import Ui_QgsOptionsBase

class DelineationDialog(QtGui.QDialog, Ui_QgsOptionsBase):
    """Set up dialog from designer."""
    def __init__(self):
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
  • How do you launch your script? – etrimaille Dec 6 '17 at 10:57
  • in pycharm interpereter is QGIS 2.18/bin/python.exe – Mustafa Uçar Dec 6 '17 at 11:00

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.