[Qgis-developer] from qgis.core impor * Windows problems

G. Allegri giohappy at gmail.com
Thu May 24 08:45:18 PDT 2012


> Hi, i tried to run bat file (C:\OSGeo4W\OSGeo4W.bat), close ms-dos shell
> and run python
>
>
> ???
If you close the shell you loose the environmental variables.
OSGeo4W.bat sets env vars for the current shell, they're not kept as system
env vars.

You need those environmantal variables to leaverage the osgeo4w libraries.
You ha mainly three choices:

 - run your python script inside a shell where you have setup the env
variables (like it is done by Osgeo4W.bat)
 - hard code the environmental variables inside your python script and add
them to os.environ, and set the path to the python modules with sys.path
 - make the various environmantal variables statically availables as system
env vars (Control Panel -> Systems -> etc.)

giovanni



>
>
>
>  ----Messaggio originale----
> Da: giohappy at gmail.com
> Data: 24/05/2012 17.15
> A: "francescoboccacci at libero.it"<francescoboccacci at libero.it>
> Cc: <qgis-developer at lists.osgeo.org>
> Ogg: Re: [Qgis-developer] from qgis.core impor * Windows problems
>
> Hi Francesco,
> are you using osgeo4w? In that case I suggest you to have a look to the
> startup .bat files (like C:\OSGeo4W\OSGeo4W.bat), that setup the right
> evnironment (python pat, bin dires, etc.)
>
> In general you have to add the various Qt and Qgis DLLs to the PATH, and
> configure the python paths to be able to peak the qgis modules.
>
> giovanni
>
> 2012/5/24 francescoboccacci at libero.it <francescoboccacci at libero.it>
>
>> Hi all,
>> i have a problem in my Windows PC. I try to use a python script that call
>> qgis
>> modules.
>> I tried to do :
>>
>> >>from qgis.core import *
>>
>> i receive ImportError: DLL load failed ....
>>
>> How i have to configure my environment variables to get these modules?
>> I try to find some solution on web but they aren't work.
>>
>> Thanks
>>
>> Francesco
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120524/03e45fed/attachment.html


More information about the Qgis-developer mailing list