Persistent Settings in PyScripter.ini Not Working

45 views
Skip to first unread message

Liv

unread,
Jan 24, 2025, 3:29:59 PMJan 24
to PyScripter

I am attempting to set persistent parameter settings for an agency wide deployment of PyScripter. If I set the python version manually within PyScripter, it works and the settings show up in my PyScripter.local.ini file as:

[PythonVersions-x64\Custom Versions] Path0=Conda 3.11 (64bit)=C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 Count=1 [PythonVersions-x64] InstallPath=C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3

When trying to add [Custom Params] to the Pyscripter.ini, of:

[Custom Params] Count=3 Item0=PythonDir=C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3 Item1=PythonExe=C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe Item2=PythonVer=3.11.8

PyScripter does not recognize the Python Version.

I've also tried copying and pasting the syntax from the Pyscripter.local.ini to the PyScripter.ini and that doesn't work either.

PyScripter

unread,
Jan 24, 2025, 4:36:23 PMJan 24
to PyScripter
Let me provide some more general background info first, which you may already know.
  • There are two settings files PyScripter.ini and PyScripter.local.ini.  The idea is that the local.ini file contains settings that depend on the specific computer features such as the screen resolution (layouts) and the installed python versions.  PyScripter.ini should be portable across different computers.
  • If you install PyScripter using the installer the setting files are stored in %APPDATA%\PyScripter, where %APPDATA% is the value of the Windows environment variable.  In zip installations, the settings files are in the same directory as the PyScripter executable.   What PyScripter does, is check first whether the directory with the executable contains PyScripter.ini.  If it does it assumes a registry free installation and does not use any directory outside that directory.  Thus, it is isolated from other installations or settings.
Regarding parameters
  • Parameters are used to create external tools among other things.  There are built-in parameters such as $[ActiveDoc] or  $[PythonExe] and user-defined or custom parameters.  You can see the full list by pressing Shft+Ctrl+P in the editor or by consulting the help file.
  • Currently you cannot overwrite built-in parameters with custom ones using the same name.
  • Custom parameters are saved in PyScripter.ini.
For a company-wide deployment you have at least a couple of options:
  1. Deploy an isolated installation (zip file which will be expanded) which includes customized versions of the settings files.  This would allow working side-by-side with other installed versions of PyScripter.  It would also allow to include python itself and any other related files (for instance, python libraries) in the same zip file.
  2. Install PyScripter in the user machine, but then overwrite the settings files  in the %APPDATA%\PyScripter folder with the customized ones.
Hope this helps.

Andreas Müller

unread,
Jan 24, 2025, 5:02:51 PMJan 24
to pyscr...@googlegroups.com
I'm using Pyscripter (.zip/Portable) with ArcGIS Pro and use a batch file to start it. The reason is that if you want to use arcpy, you'll have to activate the conda environment before Pyscripter starts. After all, I don't have problems with Settings.

24.01.2025 21:30:02 Liv <ohug...@gmail.com>:

--
You received this message because you are subscribed to the Google Groups "PyScripter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyscripter+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pyscripter/a7772cf4-305c-4946-9550-c9945d851975n%40googlegroups.com.

PyScripter

unread,
Jan 24, 2025, 5:09:18 PMJan 24
to PyScripter
Are you sure that you need to activate the Conda environment before running PyScripter?  PyScripter works well with Conda environments without doing that.  See this blog post regarding  ArcGIS Pro.

Andreas Müller

unread,
Jan 28, 2025, 11:06:20 AMJan 28
to PyScripter
You are right, setting a new (unregistered) python to "%ProgramFiles%\ArcGIS\Pro\bin\Python\envs\arcgispro-py3" also allows me to run standalone scripts in PyScripter. 
Here: https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/using-conda-with-arcgis-pro.htm Esri describes several ways and I just adapted the method ESRI uses in their bat file "propy.bat". It detects the currently used/set conda environment in ArcGIS Pro and activates it. So, if you have another conda environment "active", it will be used in PyScripter as well, in my case with this batch file:
---
@echo off
:: set this according to your locations
set arcprobin=%ProgramFiles%\ArcGIS\Pro\bin
set pyscripter=%~dp0\PyScripter\PyScripter.exe

@CALL :normalizepath arcprobin_path "%arcprobin%"

FOR /F "delims=" %%i IN ('"%arcprobin_path%\PythonEnvUtils.exe"') DO set CONDA_NEW_ENV=%%i

call "%arcprobin%\Python\Scripts\activate.bat" "%CONDA_NEW_ENV%"

start "PyScripter" "%
pyscripter%" --pythondllpath="%CONDA_NEW_ENV%"

:normalizepath
    @set "%1=%~s2"
    @exit /b

---
Reply all
Reply to author
Forward
0 new messages