[GRASS-dev] Continuing: Windows comatibility: python import pwd
Anna Petrášová
kratochanna at gmail.com
Tue Sep 6 05:44:23 PDT 2016
On Tue, Sep 6, 2016 at 8:39 AM, Robert Kuszinger <kuszinger at giscom.hu> wrote:
>
> Sorry, the previous one was an accidental send....
>
> ---------- COMPLETE MESSAGE IS HERE: ----------
>
>
> Hello,
>
> I've realized that m.printws won't compile on windows from the repository.
>
> -------------------------------Information source:
>
> https://wingrass.fsv.cvut.cz/grass70/x86_64/addons/latest/logs/
>
> and especially:
>
> https://wingrass.fsv.cvut.cz/grass70/x86_64/addons/latest/logs/m.printws.log
>
> -------------------------------End of Log:
>
> [...]
> m.printws.tmp.html ; fi
> Traceback (most recent call last):
> File
> "C:/Users/landa/grass_packager/grass705RC1/x86_64/addons/m.printws/scripts/m.printws.py",
> line 177, in <module>
> import pwd
> ImportError: No module named pwd
> /c/msys64/usr/src/grass705RC1/include/Make/Html.make:14: recipe for target
> 'm.printws.tmp.html' failed
> make: *** [m.printws.tmp.html] Error 1
> rm m.printws.tmp.html
>
>
> I've realized that pwd module is not available on windows. Very well, I
> made a functional workaround and the key part is this:
>
> if os.name <> 'nt':
> import pwd
>
> (and yes, later on it is handled as well.... but his causes the compilation
> error)
>
>
> Will it pass the compile test? Or should I do something completely
> different?
>
>
> thanks Robert
or perhaps:
hasPwd = True
try:
import pwd
except ImportError:
hasPwd = False
and then use hasPwd to handle the rest
This is more general, it doesn't depend on operating system.
>
>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
More information about the grass-dev
mailing list