Re: [QGIS-Developer] Issue running processing model from Python

2018-04-26 Thread Nyall Dawson
On 26 April 2018 at 17:14, Andreas Neumann  wrote:
> Hi,
>
> Issue solved - turned out that the layer in the project file was renamed (by
> a colleague) and hence processing could not find the feature source. All
> works fine now. Silly me!
>
> However, the processing error message was really misleading and had no
> indication that it could not find the layer. Nyall is going to fix the error
> message - thanks!

Hi Andreas,

Should be fixed by https://github.com/qgis/QGIS/pull/6874 . I'd
greatly value a test of that branch with the invalid project/model
combination to confirm that you get a helpful error message.

Nyall

>
> Sorry about the noise - it is a classic "beginners mistake" ;-)
>
> Andreas
>
> On 2018-04-25 12:19, Tom Chadwin wrote:
>
> Sorry, not having worked with models, I don't know. Only thing I wonder is
> whether it is a problem to have colons in a dictionary key
> (native:orderbyexpression_1:Ausgabedatei).
>
> Tom
>
>
>
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Issue running processing model from Python

2018-04-26 Thread Andreas Neumann
Hi, 

Issue solved - turned out that the layer in the project file was renamed
(by a colleague) and hence processing could not find the feature source.
All works fine now. Silly me! 

However, the processing error message was really misleading and had no
indication that it could not find the layer. Nyall is going to fix the
error message - thanks! 

Sorry about the noise - it is a classic "beginners mistake" ;-) 

Andreas 

On 2018-04-25 12:19, Tom Chadwin wrote:

> Sorry, not having worked with models, I don't know. Only thing I wonder is
> whether it is a problem to have colons in a dictionary key
> (native:orderbyexpression_1:Ausgabedatei).
> 
> Tom
> 
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Issue running processing model from Python

2018-04-25 Thread Tom Chadwin
Sorry, not having worked with models, I don't know. Only thing I wonder is
whether it is a problem to have colons in a dictionary key
(native:orderbyexpression_1:Ausgabedatei).

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Issue running processing model from Python

2018-04-25 Thread Andreas Neumann
Hi Tom, 

line 45 is 

processing.run("model:Anlagen-Export",parameters,feedback=None) 

The previous line is setting the parameters: 

parameters = {'vfewsanlagen':
QgsProcessingFeatureSourceDefinition('Anlage', True),
'native:orderbyexpression_1:Ausgabedatei' : 'C:/temp/ews_anlagen.xlsx' }


Thanks, 

Andreas 

On 2018-04-25 11:33, Tom Chadwin wrote:

> Which is line 45?
> 
> Tom
> 
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Issue running processing model from Python

2018-04-25 Thread Tom Chadwin
Which is line 45?

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Issue running processing model from Python

2018-04-25 Thread Andreas Neumann
Hi, 

I want to run a model from Python code in QGIS 3.0x (recent nightly). 

Here is my code: 

--- 

def exportAnlagenAlsExcel():
# Prepare processing framework
from qgis.core import QgsProcessingFeatureSourceDefinition
from processing.core.Processing import Processing
Processing.initialize()
import processing
parameters = {'vfewsanlagen':
QgsProcessingFeatureSourceDefinition('Anlage', True),
'native:orderbyexpression_1:Ausgabedatei' : 'C:/temp/ews_anlagen.xlsx' }
processing.run("model:Anlagen-Export",parameters,feedback=None)
#open Resultatesfile in MS Excel
command = 'start C:\\temp\\ews_anlagen.xlsx'
os.system(command)
iface.messageBar().pushInfo("Information",u"ExcelExport fertig") 

--- 

However, when running the script I get an error with a message I can't
interpret or solve: 

--- 

2018-04-25T08:09:51 WARNING Traceback (most recent call last): 

File "", line 45, in exportAnlagenAlsExcel 

File
"C:/Programme/OSGeo4W64/apps/qgis-rel-dev/./python/plugins\processing\tools\general.py",
line 84, in run 

return Processing.runAlgorithm(algOrName, parameters, onFinish,
feedback, context) 

File
"C:/Programme/OSGeo4W64/apps/qgis-rel-dev/./python/plugins\processing\core\Processing.py",
line 193, in runAlgorithm 

raise QgsProcessingException(msg) 

_core.QgsProcessingException: There were errors executing the algorithm.


--- 

Do you know what is wrong in my Python code above? I am pretty sure that
the very same code ran in an older version of QGIS 3. 

Thank you for your help, 

Andreas___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer