How to retrieve the data source of the active layer? [on hold] Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?QGIS 3 - Python : QgsVectorLayerJoinInfo issueJoin CSV and shapefile in PyQGISError in executing Voronoi polygon algorithmWhy a QgsExpression does not evaluate a feature as expected in PyQGIS 3?QGIS vector layer labels are not showing from python scriptPyQGIS QgsVectorLayer() Loads Invalid Layer in Standalone Python 3 ScriptQGIS Processing Script Stops Working After First RunRename fields of shapefile using PyQGIS 3PYQGIS 3 Using the ouptut from GRASS v.distance algorithmHow to resolve QGIS 3 syntax error from processing.algorithmHelp?
How to zip specific files that are located in subdirectories
List *all* the tuples!
Bold symbols in LuaLaTeX with setmathfont
If 'B is more likely given A', then 'A is more likely given B'
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
Why is "Consequences inflicted." not a sentence?
3 doors, three guards, one stone
Why is "Captain Marvel" translated as male in Portugal?
Should I call the interviewer directly, if HR aren't responding?
cpython3 different behavior between running a file line by line in interpreter mode and "python3 file"
The logistics of corpse disposal
Are my PIs rude or am I just being too sensitive?
How was the dust limit of 546 satoshis was chosen? Why not 550 satoshis?
What is the longest distance a 13th-level monk can jump while attacking on the same turn?
Compressing georeferenced images
Is there a service that would inform me whenever a new direct route is scheduled from a given airport?
When -s is used with third person singular. What's its use in this context?
Antler Helmet: Can it work?
How much radiation do nuclear physics experiments expose researchers to nowadays?
macOS-like app switching in Plasma 5
Can a non-EU citizen traveling with me come with me through the EU passport line?
How is the internal pullup resistor in a microcontroller wired?
How can I make names more distinctive without making them longer?
How to retrieve the data source of the active layer? [on hold]
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?QGIS 3 - Python : QgsVectorLayerJoinInfo issueJoin CSV and shapefile in PyQGISError in executing Voronoi polygon algorithmWhy a QgsExpression does not evaluate a feature as expected in PyQGIS 3?QGIS vector layer labels are not showing from python scriptPyQGIS QgsVectorLayer() Loads Invalid Layer in Standalone Python 3 ScriptQGIS Processing Script Stops Working After First RunRename fields of shapefile using PyQGIS 3PYQGIS 3 Using the ouptut from GRASS v.distance algorithmHow to resolve QGIS 3 syntax error from processing.algorithmHelp?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to get the data source of the layer in the Python action within the layer property. My code in the Python action is:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
When I run the action, the script returned the following error:
An error occurred during execution of following code:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
If I run the same script in the Python console, it has no problem returning the name of the data source.
Does anybody know why the script failed if I run it as Python action?
pyqgis-3
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Jochen Schwarze, whyzar, Vince, Evil Genius, Andre Silva Apr 12 at 14:21
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, Evil Genius, Andre Silva
add a comment |
I am trying to get the data source of the layer in the Python action within the layer property. My code in the Python action is:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
When I run the action, the script returned the following error:
An error occurred during execution of following code:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
If I run the same script in the Python console, it has no problem returning the name of the data source.
Does anybody know why the script failed if I run it as Python action?
pyqgis-3
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Jochen Schwarze, whyzar, Vince, Evil Genius, Andre Silva Apr 12 at 14:21
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, Evil Genius, Andre Silva
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01
add a comment |
I am trying to get the data source of the layer in the Python action within the layer property. My code in the Python action is:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
When I run the action, the script returned the following error:
An error occurred during execution of following code:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
If I run the same script in the Python console, it has no problem returning the name of the data source.
Does anybody know why the script failed if I run it as Python action?
pyqgis-3
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am trying to get the data source of the layer in the Python action within the layer property. My code in the Python action is:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
When I run the action, the script returned the following error:
An error occurred during execution of following code:
layer = iface.activeLayer()
QMessageBox.information(None, "parDir: ", layer.source())
If I run the same script in the Python console, it has no problem returning the name of the data source.
Does anybody know why the script failed if I run it as Python action?
pyqgis-3
pyqgis-3
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited Apr 9 at 1:42
Vince
14.8k32850
14.8k32850
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Apr 9 at 1:39
PFTPFT
61
61
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
PFT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Jochen Schwarze, whyzar, Vince, Evil Genius, Andre Silva Apr 12 at 14:21
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, Evil Genius, Andre Silva
put on hold as off-topic by Jochen Schwarze, whyzar, Vince, Evil Genius, Andre Silva Apr 12 at 14:21
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, Evil Genius, Andre Silva
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01
add a comment |
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've found the problem with the script. I need to add the following for the script to work: from qgis.utils import iface from PyQt5.QtWidgets import QMessageBox
– PFT
Apr 9 at 8:01