Re: [Qgis-user] Python Problems

2023-08-01 Thread Ujaval Gandhi via QGIS-User
Looks like it is coming from qgis2web and relates to access to the file you are using. You already received a response to the same query before, so avoid posting the same question again without additional information.---Ujaval GandhiSpatial Thoughtswww.spatialthoughts.comOn Tue, Aug 1, 2023 at 9:45 PM John Studley via QGIS-User  wrote:



Dear AllWhy am I getting the following error - how do I resolve it?RegardsJohnAn error has occurred while executing Python code: 
ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file not found, no access). 
Traceback (most recent call last):  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 321, in cwd_and_create    ftp.cwd(p)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd    return self.voidcmd(cmd)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in voidcmd    return self.voidresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in voidresp    resp = self.getresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in getresp    raise error_perm(resp)ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file not found, no access).During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 321, in cwd_and_create    ftp.cwd(p)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd    return self.voidcmd(cmd)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in voidcmd    return self.voidresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in voidresp    resp = self.getresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in getresp    raise error_perm(resp)ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file not found, no access).During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 321, in cwd_and_create    ftp.cwd(p)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd    return self.voidcmd(cmd)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in voidcmd    return self.voidresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in voidresp    resp = self.getresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in getresp    raise error_perm(resp)ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file not found, no access).During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\maindialog.py", line 354, in saveMap    result = self.exporter.postProcess(results, feedback=self.feedback)  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 330, in postProcess    cwd_and_create(self.remote_folder)  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 324, in cwd_and_create    cwd_and_create(parent)  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 324, in cwd_and_create    cwd_and_create(parent)  File "C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py", line 327, in cwd_and_create    ftp.mkd(base)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 637, in mkd    resp = self.voidcmd('MKD ' + dirname)  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in voidcmd    return self.voidresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in voidresp    resp = self.getresp()  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in getresp    raise error_perm(resp)ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file not found, no access).
Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS version: 3.28.8-Firenze Firenze, 5ac45272b5 
Python Path:
C:/PROGRA~1/QGIS32~1.8/apps/qgis-ltr/./python
C:/Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS32~1.8/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS32~1.8\apps\grass\grass82\etc\python
C:\Users\Windows\Documents
C:\Program Files\QGIS 3.28.8\bin\python39.zip
C:\PROGRA~1\QGIS32~1.8\apps\Python39\DLLs
C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib
C:\Program Files\QGIS 3.28.8\bin
C:\PRO

[Qgis-user] Python Problems

2023-08-01 Thread John Studley via QGIS-User

Dear All

Why am I getting the following error - how do I resolve it?

Regards

John

An error has occurred while executing Python code:
ftplib.error_perm: 550 Requested action not taken. File unavailable 
(e.g., file not found, no access).

Traceback (most recent call last):
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 321, in cwd_and_create
ftp.cwd(p) 
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd
return self.voidcmd(cmd)
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in 
voidcmd
return self.voidresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in 
voidresp
resp = self.getresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in 
getresp
raise error_perm(resp)
ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file 
not found, no access).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 321, in cwd_and_create
ftp.cwd(p) 
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd
return self.voidcmd(cmd)
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in 
voidcmd
return self.voidresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in 
voidresp
resp = self.getresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in 
getresp
raise error_perm(resp)
ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file 
not found, no access).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 321, in cwd_and_create
ftp.cwd(p) 
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 625, in cwd
return self.voidcmd(cmd)
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in 
voidcmd
return self.voidresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in 
voidresp
resp = self.getresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in 
getresp
raise error_perm(resp)
ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file 
not found, no access).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\maindialog.py",
 line 354, in saveMap
result = self.exporter.postProcess(results, feedback=self.feedback)
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 330, in postProcess
cwd_and_create(self.remote_folder)
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 324, in cwd_and_create
cwd_and_create(parent)
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 324, in cwd_and_create
cwd_and_create(parent)
  File 
"C:\Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web\exporter.py",
 line 327, in cwd_and_create
ftp.mkd(base) 
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 637, in mkd
resp = self.voidcmd('MKD ' + dirname)
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 286, in 
voidcmd
return self.voidresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 259, in 
voidresp
resp = self.getresp()
  File "C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\ftplib.py", line 254, in 
getresp
raise error_perm(resp)
ftplib.error_perm: 550 Requested action not taken. File unavailable (e.g., file 
not found, no access).

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC 
v.1928 64 bit (AMD64)]

QGIS version: 3.28.8-Firenze Firenze, 5ac45272b5

Python Path:
C:/PROGRA~1/QGIS32~1.8/apps/qgis-ltr/./python
C:/Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/Windows/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS32~1.8/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS32~1.8\apps\grass\grass82\etc\python
C:\Users\Windows\Documents
C:\Program Files\QGIS 3.28.8\bin\python39.zip
C:\PROGRA~1\QGIS32~1.8\apps\Python39\DLLs
C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib
C:\Program Files\QGIS 3.28.8\bin
C:\PROGRA~1\QGIS32~1.8\apps\Python39
C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\site-packages
C:\PROGRA~1\QGIS32~1.8\apps\Python39\lib\site-packages\win32
C:\PROGRA~1\QGIS32~1.8\apps\Python

[Qgis-user] Add context menu to map canvas

2023-08-01 Thread Christoph Jung via QGIS-User
Hello everyone,

I try to add a new entry to the map canvas context menu using the following two 
documentations:
https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/canvas.html#add-items-to-map-canvas-contextual-menu

https://github.com/qgis/QGIS-Documentation/issues/5842

Adding a new menu entry from the python console works like a charm. Now I want 
to provide the context menu through a plugin. But I am not able to connect the 
context menu with a signal declared as a function in the same class, where I 
want to connect it. I receive the message, that my plugin class has no method 
„addMenu“. This is my code snippet:

from qgis.PyQt.QtWidgets import QMenu
from qgis.gui import QgsMapMouseEvent
import json
 
class SmallworldShortcutPlugin:

def __init__(self, iface):
self.iface = iface
self.canvas = self.iface.mapCanvas()
self.canvas.contextMenuAboutToShow.connect(self.populateContextMenu)

The function populateContextMenu is the same as in the documentation. But if I 
declare the function outside of the class in the same python file, it works 
very well (of course without calling the function on self). Does anybody has a 
hint for me how to connect the map canvas context menu with a function from a 
class? Or is it the right way to declare the function to be connected with the 
context menu outside of a class?

Best regards,
Christoph 

___
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user