Hi again,

I tried to implement the detection of R in processing, comparable to what has 
been done for GRASS and SAGA.

This python code finds my R properly when I run it in a python shell (except 
for the isWindows() function of course):
{{{
        if folder is None:
            if isWindows():
                if "ProgramW6432" in os.environ.keys() and 
os.path.isdir(os.path.join(os.environ["ProgramW6432"],'R')):
                    testfolder = os.path.join(os.environ["ProgramW6432"],'R')
                elif "PROGRAMFILES(x86)" in os.environ.keys() and 
os.path.isdir(os.path.join(os.environ["PROGRAMFILES(x86)"],'R')):
                    testfolder = 
os.path.join(os.environ["PROGRAMFILES(x86)"],'R')
                else:
                    testfolder = 'C:\\R'
                if os.path.isdir(testfolder):
                    subfolders = os.listdir(testfolder)
                    subfolders.sort(reverse=True)
                    for subfolder in subfolders:
                        if subfolder.startswith('R-'):
                            folder = os.path.join(testfolder, subfolder)
                            break
                else:
                    folder = ''
            else:
                folder = ''
}}}

However, when injected into the RFolder()-function RUtils.py it does not change 
anything and my R_FOLDER - although I deleted that entry from my QGIS.ini - is 
set to C:\OSGeo4W\bin which of course is not correct...

Any Ideas?

Thanks for helping...
Stefan

-----Original Message-----
From: Qgis-developer [mailto:[email protected]] On Behalf 
Of Blumentrath, Stefan
Sent: 25. januar 2016 15:56
To: Victor Olaya <[email protected]>
Cc: [email protected]
Subject: Re: [Qgis-developer] Processing provider versions and hard coded path 
in settings

Hi Victor and Alex,

Thanks for your detailed replies!
That is nice, I was not aware that the paths are "auto-detected".
I now removed the respective settings from my QGIS.ini and GRASS 6 got detected 
properly.

However, when I tried GRASS 7 algorithms, I got a Python error:

TypeError: object of type 'NoneType' has no len() Traceback (most recent call 
last):
  File 
"C:\Users\stefan.blumentrath\.qgis-custom/python/plugins\processing\gui\ProcessingToolbox.py",
 line 192, in executeAlgorithm
    message = alg.checkBeforeOpeningParametersDialog()
  File 
"C:\Users\stefan.blumentrath\.qgis-custom/python/plugins\processing\algs\grass7\Grass7Algorithm.py",
 line 531, in checkBeforeOpeningParametersDialog
    msg = Grass7Utils.checkGrass7IsInstalled()
  File 
"C:\Users\stefan.blumentrath\.qgis-custom/python/plugins\processing\algs\grass7\Grass7Utils.py",
 line 359, in checkGrass7IsInstalled
    cmdpath = os.path.join(path, 'bin', 'r.out.gdal.exe')
  File "C:\OSGeo4W\apps\Python27\lib\ntpath.py", line 96, in join
    assert len(path) > 0
TypeError: object of type 'NoneType' has no len()


Python version: 2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit 
(Intel)] 
QGIS version: 2.12.3-Lyon Lyon, 02885d5

So, I had a look at Grass7Utils.py and filed PR #2720.
Sorry for the conflicts in the PR (I just changed two lines). I am a 
git-beginner...
That should make path detection work for GRASS 7 again.
Yet, folder layout is OSGeo4W\apps\grass\grass-7.0.3RC2. But in 
OSGeo4W\apps\grass\, there can be also a grass-7.0.2 folder present in 
addition...

Cheers
Stefan


-----Original Message-----
From: Victor Olaya [mailto:[email protected]] 
Sent: 25. januar 2016 13:22
To: Blumentrath, Stefan <[email protected]>
Cc: Alexander Bruy <[email protected]>; [email protected]
Subject: Re: [Qgis-developer] Processing provider versions and hard coded path 
in settings

Stefan,

here is a quick explanation

The paths are not hardcoded on the first install. Instead, Processing tries to 
find those dependencies (which usually works fine in osgeo4w distributions),or 
lets the user configure them manually. Once they are configured manually (as 
you have done), that value is stored as a setting (and written to the ini file 
for further uses). If you change your QGIS version or Processing version, the 
configuration is not changed, so it will use that value again and again (and 
since it is already configured, a new version of Processing wont try to find 
those dependencies).

The only solution to that is to have different ini files and specify which one 
to use in each case, using the --configpath option

Cheers

2016-01-25 12:54 GMT+01:00 Blumentrath, Stefan <[email protected]>:
> Hi Alex,
>
> Thanks for your reply, and sorry if my question was a bit unclear...
>
> When I want to use e.g. GRASS 7 in Processing, I have to provide the 
> path to the "GRASS7 folder" in Processing --> Processing Options --> 
> Providers From there, in my case e.g. "C:\Program Files (x86)\QGIS 
> Lyon\apps\grass\grass-7.0.3RC2" has been saved as an absolute path to my 
> QGIS.ini file in my home directory.
>
> If I use different QGIS versions in parallel (e.g. latest stable and LTR) the 
> path can change. Furthermore, I have to update it manually, after each update 
> of GRASS or SAGA (because then the paths change as well...
>
> This is what I meant, not the source code...
>
> But maybe it would be better to have the paths themselves more stable...
> Recently, Helmut Kudrnovsky did some work on making RStudio available in the 
> GRASS console in OSGeo4W. Maybe something like this is needed to grab the 
> path to GRASS, SAGA or R for processing...?
>
> Cheers
> Stefan
>
>
> -----Original Message-----
> From: Alexander Bruy [mailto:[email protected]]
> Sent: 25. januar 2016 12:13
> To: Blumentrath, Stefan <[email protected]>
> Cc: [email protected]
> Subject: Re: [Qgis-developer] Processing provider versions and hard 
> coded path in settings
>
> Hi Stefan,
>
> Processing providers are just plugins, so they installed in the global QGIS 
> plugins directory. There is no hadrcoding in Processing sources related to 
> the providers.
>
> 2016-01-25 12:04 GMT+02:00 Blumentrath, Stefan <[email protected]>:
>> Dear devs,
>>
>>
>>
>> In my QGIS.ini, the paths to the Processing providers are hard coded, 
>> which means I have to manually adjust them after every software 
>> update (Saga, GRASS, R).
>>
>> Any chance to pass the updates to the user(s)`s QGIS settings (or 
>> make QGIS recognizing the Processing providers installed together 
>> with QGIS), or is this only a limitation of the --configpath solution?.
>>
>>
>>
>> Should I extend:
>>
>> http://hub.qgis.org/issues/12623
>>
>> (as it seems related) or should I open a new ticket (in case this 
>> wanted and feasible of course)...
>>
>>
>>
>> Kind regards,
>>
>> Stefan
>>
>>
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> [email protected]
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> --
> Alexander Bruy
> _______________________________________________
> Qgis-developer mailing list
> [email protected]
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to