<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 10, 2014 at 10:03 AM, Nikos Alexandris <span dir="ltr"><<a href="mailto:nik@nikosalexandris.net" target="_blank">nik@nikosalexandris.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">Nikos Alexandris wrote:<br>
<br>
> > I have this script<br>
> > <<a href="https://github.com/NikosAlexandris/i.fusion.hpf.py" target="_blank">https://github.com/NikosAlexandris/i.fusion.hpf.py</a>>. My local<br>
> > Makefile, with which I am trying to compile currently, is:<br>
<br>
> >   MODULE_TOPDIR = ../..<br>
> ><br>
> >   PGM = i.fusion.hpf<br>
> ><br>
> >   ETCFILES = high_pass_filter constants<br>
> ><br>
> >   include $(MODULE_TOPDIR)/include/Make/Script.make<br>
> >   include $(MODULE_TOPDIR)/include/Make/Python.make<br>
<br>
> > * Is the order of entries in ETCFILES significant? (high_pass_filter<br>
> > needs stuff from constants)<br>
<br>
> > * While both files are to be found, after compilation, under<br>
> > </grass70/dist.x86_64-unknown-linux-gnu/etc/i.fusion.hpf>, the script<br>
> > runs fine only when executing it from *any*, if I understand<br>
> > correctly, directory in which the helper file(s)<br>
> > "high_pass_filter.py(c)" is(are) in.<br>
<br>
> > I can't work this out. Thank you, Nikos<br>
><br>
> Thanks to "r.in.wms", fixed by using this line:<br>
><br>
> +sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc',<br>
> 'r.in.wms'))<br>
<br>
</span>This approach broke for my script i.fusion.hpf again. The sys.path[0] is an empty string (now). I have<br>
no idea why it did work before.<br>
<br>
Is the approach in <a href="http://v.class.ml" target="_blank">v.class.ml</a> relevant/better/safer:<br>
<<a href="http://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.class.ml/v.class.ml.py?order=date#L380" target="_blank">http://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.class.ml/v.class.ml.py?order=date#L380</a>>?<br></blockquote><div><br></div><div>This is used on more places. I suggest to go with that although I'm afraid it is not perfect either.<br><br>See other examples:<br><a href="http://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py#L95">http://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py#L95</a><br><a href="http://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.segment.hierarchical/i.segment.hierarchical.py#L153">http://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.segment.hierarchical/i.segment.hierarchical.py#L153</a><br><br></div><div>See the implementation:<br><a href="http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/utils.py#L264">http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/utils.py#L264</a><br><br></div><div>See related tickets:<br><a href="http://trac.osgeo.org/grass/ticket/2132">http://trac.osgeo.org/grass/ticket/2132</a><br><a href="https://trac.osgeo.org/grass/ticket/2097">https://trac.osgeo.org/grass/ticket/2097</a><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class=""><div class="h5"><br>
<br>
Nikos<br>
_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
</div></div></blockquote></div><br></div></div>