using Pyscripter with Osgeo4w

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using Pyscripter with Osgeo4w

Matt Wilkie
Hi Folks,

This took a bit of time to figure out, so I figured out I'd share for posterity. Pyscripter isn't my normal IDE, but it's popular, especially in the ArcGIS ecosystem. Here's how to get it working with Osgeo4W python instead of "the other one":

Install pyscripter, create this batchfile, adjusting path as needded, and save it in PATH, run it, done.

    %~d0\apps\PyScripter\PyScripter.exe %* --pythondllpath=%osgeo4w_root%\bin

Explanation:

    %~d0: expands to Drive letter that batch file exists on, e.g. c:\bin\pyscripter.bat

    %*: expands command line arguments, allows `pyscripter.bat d:\code\somefile.py`. It must precede pyscripter option arguments.

    --pythondllpath: needed when pythonxx.dll doesn't reside in same folder as python.exe.

cheers,

Matt

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: using Pyscripter with Osgeo4w

Matt Wilkie

On Sat, Mar 21, 2015 at 11:02 AM, Matt Wilkie <[hidden email]> wrote:
    %~d0\apps\PyScripter\PyScripter.exe %* --pythondllpath=%osgeo4w_root%\bin

Use this instead to avoid blocking the calling shell:

    start /b "Pyscripter" cmd.exe /c %~d0\apps\PyScripter\PyScripter.exe %* --pythondllpath=%osgeo4w_root%\bin



_______________________________________________
osgeo4w-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: using Pyscripter with Osgeo4w

Matt Wilkie
You don't need to duplicate the call ini scripts and setting of python path, start osgeo4w shell and then run the pyscripter.bat from previous post all in one go:

     C:\osgeo4w\osgeo4w.bat pyscripter.bat

...and I'm not using the remote interpreter. If you're willing to tinker with the o4w install you should be able to get it to work by copying python.exe to PYTHONHOME (./apps/Python27).


Digression:

The issue is that we follow 'nix convention and split the standard Windows python structure into "bin" and "lib". I think eventually we will have to merge it back, putting everything together under ./apps/PythonXX. It'll be a way to support simultaneous Pyhon 2 and 3, perhaps the only way.

I've been hesitant to suggest or start that because it will touch almost everybody (esp. package maintainers) and I don't have the time to devote to seeing it through.

Cheers,

matt



On Mon, Mar 23, 2015 at 4:00 AM, Müller, Andreas, Dr. phil. <[hidden email]> wrote:
Hi Matt,
i was using PyScripter with my portable Install of osgeo4w. Never had issues starting it, but it does shows strange behaviour when you work with several scripts, one importing the others.
I read about using a remote python engine, but had no luck, because changing the pythonpath to
%osgeo4w_root%\apps\Python27 AND using remserver doesn't work. How did you configure PyScripter?

my start script:
set PYSC_DIR=%~dp0

rem calling osgeo4w ini-scripts, incl. python.bat
for %%F in ("%OSGEO4W_ROOT%\etc\ini\*.bat") do call "%%F"

rem setting pythonpath, it's more than needed
SET PYTHONPATH=%OSGEO4W_ROOT%\apps\python27\lib;%OSGEO4W_ROOT%\apps\python27\lib\site-packages;%OSGEO4W_ROOT%\bin;%PYSC_DIR%\Lib;

rem start Pyscripter
start "PyScripter" /B %PYSC_DIR%\PyScripter.exe --python27 --pythondllpath=%OSGEO4W_ROOT%\bin

Dr. Andreas Müller -_- Universität Trier - FB VI - Kartographie, [hidden email]

54286 Trier, Behringstr. 29, F 191, <a href="tel:%2B%2B496512014576" value="+496512014576" target="_blank">++496512014576


Von: [hidden email] [[hidden email]]" im Auftrag von "Matt Wilkie [[hidden email]]
Gesendet: Samstag, 21. März 2015 19:09
An: osgeo4w-dev
Betreff: Re: [osgeo4w-dev] using Pyscripter with Osgeo4w


On Sat, Mar 21, 2015 at 11:02 AM, Matt Wilkie <[hidden email]> wrote:
    %~d0\apps\PyScripter\PyScripter.exe %* --pythondllpath=%osgeo4w_root%\bin

Use this instead to avoid blocking the calling shell:

    start /b "Pyscripter" cmd.exe /c %~d0\apps\PyScripter\PyScripter.exe %* --pythondllpath=%osgeo4w_root%\bin




_______________________________________________
osgeo4w-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev