Open PlayItAll opened 5 years ago
This has nothing to do with SpreadSheetLayers plugin but with QGIS core plugin "Processing".
I just tried to do it an example file and it works perfectly. test_entete_float.xlsx
import processing
processing.runAndLoadResults("qgis:createpointslayerfromtable",
{
'INPUT':'/home/amorvan/data/meddtl_qgis/SpreadsheetLayers/test_entete_float.xlsx',
'XFIELD':'Longitude',
'YFIELD':'Latitude',
'ZFIELD':None,
'MFIELD':None,
'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'),
'OUTPUT':'memory'
})
Hi Arnaud,
thank you so much for responding so quickly!
When I run your code, I am still getting an error message:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "", line 1, in
It seems to me, that the code in the processing.py script does not recognize the createpointslayerfromtable as an instance: @staticmethod def runAlgorithm(algOrName, parameters, onFinish=None, feedback=None, context=None): if isinstance(algOrName, QgsProcessingAlgorithm):
Do you have an idea, what could be the problem in my setup?
Thanks so much!
Axel On Tuesday, July 2, 2019, 6:59:40 p.m. GMT+2, Arnaud Morvan notifications@github.com wrote:
This has nothing to do with SpreadSheetLayers plugin but with QGIS core plugin "Processing".
I just tried to do it an example file and it works perfectly. test_entete_float.xlsx import processingprocessing.runAndLoadResults("qgis:createpointslayerfromtable",{ 'INPUT':'/home/amorvan/data/meddtl_qgis/SpreadsheetLayers/test_entete_float.xlsx', 'XFIELD':'Longitude', 'YFIELD':'Latitude', 'ZFIELD':None, 'MFIELD':None, 'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'), 'OUTPUT':'memory'}) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I can propose you to right click on an empty spaces in toolbars and check the "Log Message Panel". In "processing" or other tab of this panel you could get more informations about what is going wrong.
Hi Arnaud, thanks so much for your help! This is what the "processing" tab looks like after running your code:
I looked at line 112 in the script, but frankly my programming skills are next to none. Does this information tell you anything that could solve my problem?
And this is what the "python warning" tab looks like after running your code:
On Wednesday, July 3, 2019, 10:59:38 a.m. GMT+2, Arnaud Morvan <notifications@github.com> wrote:
I can propose you to right click on an empty spaces in toolbars and check the "Log Message Panel". In "processing" or other tab of this panel you could get more informations about what is going wrong.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Sorry but I do not see the logs in your post.
Hi Arnaud, I guess my screenshots got lost somewhere... The code I am using: import processing processing.runAndLoadResults("qgis:createpointslayerfromtable", { 'INPUT':r'C:\Users\heubacha\Desktop\Delete\test_entete_float.xlsx', 'XFIELD':'Longitude', 'YFIELD':'Latitude', 'ZFIELD':None, 'MFIELD':None, 'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'), 'OUTPUT':'memory' })
This is what the "processing" tab looks like after running your code:
2019-07-03T13:19:43 CRITICAL Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins\processing\algs\qgis\PointsLayerFromTable.py", line 112, in processAlgorithm fields, wkb_type, target_crs) Exception: unknown 2019-07-03T13:19:43 CRITICAL Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins\processing\algs\qgis\PointsLayerFromTable.py", line 112, in processAlgorithm fields, wkb_type, target_crs) Exception: unknown 2019-07-03T13:19:43 CRITICAL There were errors executing the algorithm.
I looked at line 112 in the script, but frankly my programming skills are next to none. Does this information tell you anything that could solve my problem?
And this is what the "python warning" tab looks like after running your code: 2019-07-03T13:19:43 WARNING warning:console:1: ResourceWarning: unclosed file traceback: File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console.py", line 575, in runScriptEditor self.tabEditorWidget.currentWidget().newEditor.runScriptCode() File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_editor.py", line 629, in runScriptCode .format(filename.replace("\", "/"), sys.getfilesystemencoding())) File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_sci.py", line 635, in runCommand more = self.runsource(src) File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\console\console_sci.py", line 665, in runsource return super(ShellScintilla, self).runsource(source, filename, symbol) File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 74, in runsource self.runcode(code) File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in
On Wednesday, July 3, 2019, 1:03:37 p.m. GMT+2, Arnaud Morvan <notifications@github.com> wrote:
Sorry but I do not see the logs in your post.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Sorry, I do not know what is going wrong, I cannot reproduce so I cannot identify precisely the problem.
Hi Arnaud, thank you so much for your time and I hope I can sometime in the future find out, why it's not working for me. Bye now :) Axel
On Wednesday, July 3, 2019, 2:12:15 p.m. GMT+2, Arnaud Morvan <notifications@github.com> wrote:
Sorry, I do not know what is going wrong, I cannot reproduce so I cannot identify precisely the problem.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi, I'm running QGIS 3.4 with Python 3 and would like to automate the creation of vector layers from spreadsheets. The following Code
from qgis.core import * import processing processing.run("qgis:createpointslayerfromtable", {'INPUT':r'C:\Users\Desktop\PlayItAll\Test.xlsx', 'XFIELD':'X_Pos', 'YFIELD':'Y_Pos', 'ZFIELD':None, 'MFIELD':None, 'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'),
'OUTPUT':r'memory'})
...produces this error:
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins\processing\core\Processing.py", line 183, in runAlgorithm raise QgsProcessingException(msg)
Can you please help me with this ?