<div dir="ltr">> <span style="font-size:12.800000190734863px">AttributeError: class Processing has no attribute 'Initialize'</span><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">Did you try : </span><span style="font-size:12.800000190734863px">'initialize' ?</span></div><div><span style="font-size:12.800000190734863px">According to </span><a href="https://github.com/qgis/QGIS/blob/master/python/plugins/processing/core/Processing.py#L146">https://github.com/qgis/QGIS/blob/master/python/plugins/processing/core/Processing.py#L146</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-30 20:51 GMT+07:00 Eric Goddard <span dir="ltr"><<a href="mailto:egoddard1010@gmail.com" target="_blank">egoddard1010@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Victor, I had tried that within the QGIS Python console and got<br>
the same error about the number of arguments. When I drop the OUTPUT<br>
parameter it runs, so now my call looks like this:<br>
<br>
processing.runalg('qgis:<wbr>selectbylocation', "photos", "boundaries",<br>
u'intersect', 0.0, 0)<br>
<br>
If I run just this line in the interpreter, it outputs:  {'OUTPUT':<br>
u'/home/eric/Development/csi_<wbr>data_collection/scripts/<wbr>photos.gpkg'}<br>
<br>
However, it doesn't select any of the points within the selected<br>
polygon boundary. If I run the tool from the Processing Toolbox, it<br>
does select the points within the boundary. When running that tool<br>
from python should it use selected features in the intersection layer?<br>
I tried it with no boundaries selected and it still didn't select<br>
anything.<br>
<br>
Thanks again for the response. Making progress, but it would still be<br>
good to get clarification on how/if Processing can be used from<br>
standalone scripts. in the call to to runalg I did have to change the<br>
layer inputs from the variables containing references to the<br>
QgsVectorLayer objects to the layer name that I passed to those vector<br>
layers on creation. Processing also couldn't find the layers until I<br>
added them to the QgsMapLayerRegistry instance, which I think means<br>
when I instantiate the QgsApplication in the standalone script I need<br>
to pass True instead of False for it to use the GUI?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Thu, Sep 29, 2016 at 4:25 PM, Victor Olaya <<a href="mailto:volayaf@gmail.com">volayaf@gmail.com</a>> wrote:<br>
> looks like the docs are outdated and the way to call the algorithm is<br>
> now different<br>
><br>
> ALGORITHM: Select by location<br>
>     INPUT <ParameterVector><br>
>     INTERSECT <ParameterVector><br>
>     PREDICATE <ParameterGeometryPredicate><br>
>     PRECISION <ParameterNumber><br>
>     METHOD <ParameterSelection><br>
>     OUTPUT <OutputVector><br>
><br>
> The PRECISION parameter is not documented in the help file.<br>
><br>
> Hope this helps<br>
><br>
> 2016-09-29 22:39 GMT+02:00 Eric Goddard <<a href="mailto:egoddard1010@gmail.com">egoddard1010@gmail.com</a>>:<br>
>> Hello everyone,<br>
>><br>
>> I'm using QGIS 2.16.3 on Ubuntu 14.04 (from the <a href="http://qgis.org/ubuntugis" rel="noreferrer" target="_blank">qgis.org/ubuntugis</a><br>
>> repo with ubuntugis-unstable ppa). I have a geopackage layer (I<br>
>> originally started out with a spatialitelayer, but I kept getting<br>
>><br>
>> ASSERT: "i.value() == handle" in file<br>
>> /tmp/buildd/qgis-2.16.3+<wbr>20trusty/src/providers/<wbr>spatialite/<wbr>qgsspatialiteconnection.cpp,<br>
>> line 780<br>
>> Aborted (core dumped)<br>
>><br>
>> when calling getFeatures() on the layer) with two columns that I want<br>
>> to populate. One contains the month and year a photo was taken,<br>
>> extracted from EXIF metadata. The other is for the name of the polygon<br>
>> that contains the point feature. Extracting the date from the metadata<br>
>> works fine, but I'm having some serious difficulties with running the<br>
>> 'qgis:selectbylocation' processing algorithm in a standalone script.<br>
>> Stack Overflow has several posts on using Processing in standalone<br>
>> scripts, the most recent of which [1] I tried. It crashes on line 15<br>
>> in my script [2](Processing.initialize()) with the following error<br>
>> message:<br>
>><br>
>> The current error message I'm getting is:<br>
>> Error in sys.excepthook:<br>
>> Traceback (most recent call last):<br>
>>   File "/usr/lib/python2.7/dist-<wbr>packages/qgis/utils.py", line 196, in<br>
>> qgis_excepthook<br>
>>     showException(type, value, tb, None, messagebar=True)<br>
>>   File "/usr/lib/python2.7/dist-<wbr>packages/qgis/utils.py", line 107, in<br>
>> showException<br>
>>     open_stack_dialog(type, value, tb, msg)<br>
>>   File "/usr/lib/python2.7/dist-<wbr>packages/qgis/utils.py", line 142, in<br>
>> open_stack_dialog<br>
>>     iface.messageBar().popWidget()<br>
>> AttributeError: 'NoneType' object has no attribute 'messageBar'<br>
>><br>
>> Original exception was:<br>
>> Traceback (most recent call last):<br>
>>   File "extract_image_dates.py", line 14, in <module><br>
>>     Processing.Initialize()<br>
>> AttributeError: class Processing has no attribute 'Initialize'<br>
>><br>
>><br>
>> Since I was unable to get it running in the standalone script, I<br>
>> loaded the script I wrote in the QGIS Python console. It ran, but it<br>
>> said that the number of arguments to 'qgis:selectbylocation' was<br>
>> wrong, but my call to the algorithim on line 55 matches the docs [3].<br>
>><br>
>> Any pointers on how to get this working would be greatly appreciated,<br>
>> and I'd be happy to make a PR on the QGIS Documentation to add a<br>
>> section about it once it works.<br>
>><br>
>><br>
>> Thanks!<br>
>> Eric<br>
>><br>
>> [1] <a href="http://gis.stackexchange.com/questions/129915/cannot-run-standalone-qgis-script" rel="noreferrer" target="_blank">http://gis.stackexchange.com/<wbr>questions/129915/cannot-run-<wbr>standalone-qgis-script</a><br>
>> [2] <a href="https://gist.github.com/egoddard/c188c62115f2fe8df24f32b3119e51b3" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>egoddard/<wbr>c188c62115f2fe8df24f32b3119e51<wbr>b3</a><br>
>> [3] <a href="http://docs.qgis.org/2.14/en/docs/user_manual/processing_algs/qgis/vector_selection_tools.html#select-by-location" rel="noreferrer" target="_blank">http://docs.qgis.org/2.14/en/<wbr>docs/user_manual/processing_<wbr>algs/qgis/vector_selection_<wbr>tools.html#select-by-location</a><br>
>> ______________________________<wbr>_________________<br>
>> Qgis-developer mailing list<br>
>> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a></div></div></blockquote></div><br></div>