<div dir="ltr">I changed the GUIEnabled to False and processing.runalg() to general.runalg(). But even in that way I couldn't get my resulting shapefile.<div><br></div><div>The problem is that the program doesn't give me any log message, because when it tries to execute "Processing.initialize()" it just let me waiting.</div><div>I have tried to execute another function like "Processing.providers" and it returned normally (with value [] because Processing was not initialized).</div><div><br></div><div>In the PyWPS log I get only that my algorithm started. And after some time I need to kill the process and QGIS closes with a minidump.</div><div><br></div><div>It seems like Processing.initialize() is restarting the shell and then the program loses the variables of everything.</div><div><br></div><div>This problems is the same as trying to print something (print "some message"): the program keeps processing until I close the window.</div><div><br></div><div>Here is the code that I am trying to publish: <a href="http://pastebin.com/gQyF4kWF">http://pastebin.com/gQyF4kWF</a></div><div><br></div><div>I am really stuck in this part. I am going to take a look again in the <a href="https://github.com/rldhont/PyWPS-QGIS-Processing" rel="noreferrer" target="_blank" style="font-size:12.8px">PyWPS-QGIS-Processing</a>.</div><div><br></div><div>Thanks by the help!</div><div><br></div><div>Regards,</div><img width="0" height="0" class="mailtrack-img" src="https://mailtrack.io/trace/mail/96cbb67167542f52007f224d4605c1a93126ff92.png?u=394009"></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-05 14:41 GMT-02:00 Salvatore Larosa <span dir="ltr"><<a href="mailto:lrssvtml@gmail.com" target="_blank">lrssvtml@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eduardo,<br>
<span class=""><br>
On Thu, Jan 5, 2017 at 2:40 PM, Eduardo Silverio da Silva<br>
<<a href="mailto:eduardosilverio1990@gmail.com">eduardosilverio1990@gmail.com</a><wbr>> wrote:<br>
><br>
> Problem solved!<br>
><br>
> The problem is that each time that I change the PATHs, the Apache need to be restarted to update the environment variables.<br>
> Also I realized that only the PYTHONPATH in Windows is not recognized in the way that I have done before (Control Panel>Advanced system settings>Environment Variables), so I needed to put the paths in a archive that my Python could read "C:\Pytho27\paths.pth".<br>
> Now I can import qgis.core and even the plugin "processing" from qgis.<br>
><br>
> But here is another question: How to run the algorithm Extract Nodes on a local Shapefile?<br>
><br>
> # In my IDLE Python, I do this by typing:<br>
> from qgis.core import QgsApplication<br>
> from processing.core.Processing import Processing<br>
> import processing<br>
> qgis = QgsApplication([], True)<br>
> qgis.setPrefixPath('C:/Program Files/QGIS 2.18/apps/qgis', True)<br>
> qgis.initQgis()<br>
> Processing.initialize()<br>
> processing.runalg('qgis:<wbr>extractnodes', 'C:\river.shp', 'C:\result.shp')<br>
><br>
> # But when I try in PyWPS, the program stops in "Processing.initialize()", then I need to kill the process.<br>
><br>
> Any suggestions?<br>
<br>
</span>I don't know if that work (but it should), if not you should get some<br>
log message.<br>
Also, it is not necessary to set GUIEnabled argument to True (the<br>
second argument of QgsApplication).<br>
<br>
One more hint could be using the general module to execute an algorithm:<br>
<br>
from processing.tools import general<br>
general.runalg(...)<br>
<br>
Anyway, you should see some log message from processing if you run the<br>
pywps process from shell.<br>
<br>
Also, take a look at this project<br>
<a href="https://github.com/rldhont/PyWPS-QGIS-Processing" rel="noreferrer" target="_blank">https://github.com/rldhont/<wbr>PyWPS-QGIS-Processing</a><br>
<br>
Regards,<br>
-SL<br>
<br>
><br>
><br>
> Thanks<br>
<div class="HOEnZb"><div class="h5">><br>
> 2017-01-02 19:54 GMT-02:00 Eduardo Silverio da Silva <<a href="mailto:eduardosilverio1990@gmail.com">eduardosilverio1990@gmail.com</a><wbr>>:<br>
>><br>
>> Hi,<br>
>><br>
>> The way I configured the path was by accessing: Control Panel > System and Security > System > Advanced system settings > Environment Variables... (Image attached)<br>
>><br>
>> I also have tested with the following code just at the begining of the code:<br>
>><br>
>> import sys<br>
>> sys.path.append("C:\Program Files (x86)\QGIS 2.18\bin")<br>
>> sys.path.append("C:\Program Files (x86)\QGIS 2.18\apps\qgis\bin")<br>
>> sys.path.append("C:\Program Files (x86)\QGIS 2.18\apps\qgis\python")<br>
>> sys.path.append("C:\Program Files (x86)\QGIS 2.18\apps\Python27\Lib\site-<wbr>packages")<br>
>> sys.path.append("C:\Program Files (x86)\QGIS 2.18\apps\qgis\python\plugins"<wbr>)<br>
>><br>
>> and I got the same error: "No module named qgis.core".<br>
>><br>
>> Well, thanks by the help!<br>
>><br>
>> Eduardo<br>
>><br>
>> 2017-01-02 18:56 GMT-02:00 Jáchym Čepický <<a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a>>:<br>
>>><br>
>>> Well,<br>
>>><br>
>>> I have no idea, how you confiured the PYTHONPATH<br>
>>><br>
>>> but try (already proposed)<br>
>>><br>
>>> import sys<br>
>>> sys.path.append("/path/to/<wbr>qgis/")<br>
>>><br>
>>> J<br>
>>><br>
>>> Dne 2.1.2017 v 21:54 Eduardo Silverio da Silva napsal(a):<br>
>>>><br>
>>>> I have checked the GetCapabilities by accessing:<br>
>>>> <a href="http://localhost:8080/cgi-bin/pywps.cgi?service=wps&request=GetCapabilities&version=1.0.0" rel="noreferrer" target="_blank">http://localhost:8080/cgi-bin/<wbr>pywps.cgi?service=wps&request=<wbr>GetCapabilities&version=1.0.0</a><br>
>>>> and it is okay. I can even execute the example process "inputs_added".<br>
>>>><br>
>>>> Then a have checked the log messages and the result is:<br>
>>>><br>
>>>> PyWPS [2017-01-02 18:49:34,355] INFO: Setting PYWPS_PROCESSES from<br>
>>>> configuration file to c:/pywps/pywps_processes<br>
>>>> PyWPS [2017-01-02 18:49:34,388] WARNING: Could not import processes from<br>
>>>> 'pywps_processes': ImportError('No module named qgis.core',)<br>
>>>> PyWPS [2017-01-02 18:49:34,424] INFO: Following processes are imported:<br>
>>>> ['inputs_added']<br>
>>>> Traceback (most recent call last):<br>
>>>>   File "C:/pywps\pywps\Wps\__init__.<wbr>py", line 174, in _init_from_directory<br>
>>>>     [processSources.__name__])<br>
>>>>   File "c:/pywps/pywps_processes\<wbr>processing.py", line 2, in <module><br>
>>>>     from qgis.core import *<br>
>>>> ImportError: No module named qgis.core<br>
>>>><br>
>>>> As we can see, the only process imported was the "input_added", while my<br>
>>>> other algorithm "processing" gave an ImportError.<br>
>>>><br>
>>>> Eduardo,<br>
>>>><br>
>>>> 2017-01-02 18:42 GMT-02:00 Jáchym Čepický <<a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a>>:<br>
>>>><br>
>>>>> Hi,<br>
>>>>><br>
>>>>> first check, if your GetCapabilities response is ok (<br>
>>>>> <a href="http://server/wps?service=wps&request=getcapabilities" rel="noreferrer" target="_blank">http://server/wps?service=wps&<wbr>request=getcapabilities</a>) - maybe the plugin<br>
>>>>> is corrupted (it's not the stablest piece of software).<br>
>>>>><br>
>>>>> Then please one more time: check the error.log of your web server, there<br>
>>>>> should be written more - you can pass any exception or error message either<br>
>>>>> to the mailing list or share it via <a href="http://pastebin.net" rel="noreferrer" target="_blank">pastebin.net</a> or similar service<br>
>>>>><br>
>>>>> J<br>
>>>>><br>
>>>>> Dne 2.1.2017 v 21:38 Eduardo Silverio da Silva napsal(a):<br>
>>>>><br>
>>>>>> In my case I am using QGIS 2.18 (x32) and Python 2.7.13 (x32) on Windows<br>
>>>>>> 10, and I have already added the following environment variables:<br>
>>>>>><br>
>>>>>> PYTHONPATH:<br>
>>>>>> C:\Program Files (x86)\QGIS 2.18\apps\qgis\python<br>
>>>>>> C:\Program Files (x86)\QGIS 2.18\apps\qgis\python\plugins<br>
>>>>>> C:\Program Files (x86)\QGIS 2.18\apps\Python27\Lib\site-<wbr>packages<br>
>>>>>><br>
>>>>>> PATH:<br>
>>>>>> C:\Program Files (x86)\QGIS 2.18\bin<br>
>>>>>> C:\Program Files (x86)\QGIS 2.18\apps\qgis\bin<br>
>>>>>> C:\Python27<br>
>>>>>> C:\Python27\Scripts<br>
>>>>>><br>
>>>>>> Here is the code where I want to import the classes:<br>
>>>>>><br>
>>>>>> #I would like to use these classes:<br>
>>>>>> # from qgis.core import *<br>
>>>>>> # from qgis.gui import *<br>
>>>>>> # from processing.core.Processing import Processing<br>
>>>>>> # import processing<br>
>>>>>><br>
>>>>>> from pywps.Process import WPSProcess<br>
>>>>>> from types import FloatType<br>
>>>>>><br>
>>>>>> class Process(WPSProcess):<br>
>>>>>>      def __init__(self):<br>
>>>>>>          WPSProcess.__init__(self,<br>
>>>>>>               identifier       = "processar",<br>
>>>>>>               title            = "Title",<br>
>>>>>>               version          = "1",<br>
>>>>>>               storeSupported   = "false",<br>
>>>>>>               statusSupported  = "false",<br>
>>>>>>               abstract         = "Abstract")<br>
>>>>>><br>
>>>>>>          self.value1 = self.addLiteralInput(<wbr>identifier = "value1", title<br>
>>>>>> =<br>
>>>>>> "Input 1", type = FloatType)<br>
>>>>>>          self.value2 = self.addLiteralInput(<wbr>identifier = "value2", title<br>
>>>>>> =<br>
>>>>>> "Input 2", type = FloatType)<br>
>>>>>>          self.result = self.addLiteralOutput(<wbr>identifier = "result",<br>
>>>>>> title =<br>
>>>>>> "Result", type = FloatType)<br>
>>>>>><br>
>>>>>>      def execute(self):<br>
>>>>>>     # Here I would like to write the necessary code to execute the<br>
>>>>>> qgis:extractnodes algorithm:<br>
>>>>>>     # processing.runalg('qgis:<wbr>extractnodes', 'river.shp', 'output.shp')<br>
>>>>>><br>
>>>>>> v1 = self.value1.getValue()<br>
>>>>>>          v2 = self.value2.getValue()<br>
>>>>>>          self.result.setValue(v1 + v2)<br>
>>>>>>          return<br>
>>>>>> ------------------------------<wbr>--------<br>
>>>>>><br>
>>>>>> But even with those PATH variables configured I could not access the<br>
>>>>>> algorithm via WPS-client plugin.<br>
>>>>>><br>
>>>>>> Regards,<br>
>>>>>><br>
>>>>>><br>
>>>>>> 2017-01-02 17:31 GMT-02:00 Salvatore Larosa <<a href="mailto:lrssvtml@gmail.com">lrssvtml@gmail.com</a>>:<br>
>>>>>><br>
>>>>>> Hi,<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> On Mon, Jan 2, 2017 at 4:31 PM, Eduardo Silverio da Silva <<br>
>>>>>>> <a href="mailto:eduardosilverio1990@gmail.com">eduardosilverio1990@gmail.com</a>> wrote:<br>
>>>>>>><br>
>>>>>>> Hello people,<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> I have a python script that uses some classes from qgis and it runs<br>
>>>>>>>> correctly in my standalone app (IDLE Python). But when I try to publish<br>
>>>>>>>> the<br>
>>>>>>>> script through PyWPS (3.2.5), the process does not apear in the list of<br>
>>>>>>>> GetCapabilities. I think the problem is with the following imports:<br>
>>>>>>>><br>
>>>>>>>> from qgis.core import *<br>
>>>>>>>> from qgis.gui import *<br>
>>>>>>>> from processing.core.Processing import Processing<br>
>>>>>>>><br>
>>>>>>>> When I comment these lines the algorithm is showed.<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>> I guess the problem is with your environment variable, you should add the<br>
>>>>>>> QGIS python and plugins paths to PYTHONPATH and probably the QGIS lib<br>
>>>>>>> path<br>
>>>>>>> to LD_LIBRARY.<br>
>>>>>>><br>
>>>>>>> Also, any error message could be useful in order to get some help from<br>
>>>>>>> the<br>
>>>>>>> community. :)<br>
>>>>>>><br>
>>>>>>> Regards,<br>
>>>>>>> -SL<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> --<br>
>>>>>>> Salvatore Larosa<br>
>>>>>>> linkedIn: <a href="http://linkedin.com/in/larosasalvatore" rel="noreferrer" target="_blank">http://linkedin.com/in/<wbr>larosasalvatore</a><br>
>>>>>>> twitter: @lrssvt<br>
>>>>>>> skype: s.larosa<br>
>>>>>>> IRC: lrssvt on freenode<br>
>>>>>>><br>
>>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> ______________________________<wbr>_________________<br>
>>>>>> pywps-dev mailing list<br>
>>>>>> <a href="mailto:pywps-dev@lists.osgeo.org">pywps-dev@lists.osgeo.org</a><br>
>>>>>> <a href="http://lists.osgeo.org/mailman/listinfo/pywps-dev" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/pywps-dev</a><br>
>>>>>><br>
>>>>>><br>
>>>>> --<br>
>>>>> Jachym Cepicky<br>
>>>>> e-mail: <a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a><br>
>>>>> twitter: @jachymc<br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>><br>
>>> --<br>
>>> Jachym Cepicky<br>
>>> e-mail: <a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a><br>
>>> twitter: @jachymc<br>
>><br>
>><br>
>><br>
>><br>
</div></div><span class="im HOEnZb">>> --<br>
>> Eduardo Silverio da Silva<br>
>> Mestrando em Ciências Geodésicas na Universidade Federal do Paraná<br>
>> Engenheiro Cartógrafo e Agrimensor<br>
>> <a href="tel:%2B55%2041%2099873-6274" value="+5541998736274">+55 41 99873-6274</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Eduardo Silverio da Silva<br>
> Mestrando em Ciências Geodésicas na Universidade Federal do Paraná<br>
> Engenheiro Cartógrafo e Agrimensor<br>
> <a href="tel:%2B55%2041%2099873-6274" value="+5541998736274">+55 41 99873-6274</a><br>
<br>
<br>
<br>
<br>
</span><div class="HOEnZb"><div class="h5">--<br>
Salvatore Larosa<br>
linkedIn: <a href="http://linkedin.com/in/larosasalvatore" rel="noreferrer" target="_blank">http://linkedin.com/in/<wbr>larosasalvatore</a><br>
twitter: @lrssvt<br>
skype: s.larosa<br>
IRC: lrssvt on freenode<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:12.8000001907349px">Eduardo Silverio da Silva</span><br></div><div>Mestrando em Ciências Geodésicas na Universidade Federal do Paraná</div><div>Engenheiro Cartógrafo e Agrimensor</div><div>+55 41 99873-6274</div></div></div></div></div></div></div></div></div>
</div>