pssepath - Easy PSSE Python coding
====================================
*author*: whit. (whit.com.au)
`pssepath` simplifies the code required to setup the Python environment necessary
to use the PSSE API. Using `pssepath` all you have to do is::
```python
import pssepath
pssepath.add_pssepath()
import psspy
```
Tested and works on:
- PSSE 32
- PSSE 33
- PSSE 34
- PSSE 35
Supports 32 and 64 bit windows (and provides warnings when using mismatched 64
bit python when PSSE requires 32 bit python).
Using this module makes the PSSE system files available for use while avoiding
making modifications to system paths or hardcoding the location of the PSSE
system folders. This makes PSSE easy to use.
Without `pssepath`, you have to do something like this::
```python
import os
import sys
PSSE_LOCATION = r"C:\Program Files\PTI\PSSE32\PSSBIN"
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' + PSSE_LOCATION
import psspy
```
Furthermore, by including `pssepath` with any scripts you distribute, others will
be able to use your code without having to edit your code to suit their
varying install paths (such as different versions of PSSE).
It can also provide information about which version of Python to use with a
particular install of PSSE to avoid `ImportError: Bad magic number...`.
Installation
-------------
`pip install pssepath`
or copy the `pssepath` code directory (the dir that contains `core.py`) to your
project's root directory.
Usage
------
`pssepath` provides 3 methods for setting up the PSSE paths:
- `pssepath.add_pssepath()`
Adds the most recent version of PSSE that works with the currently
running version of Python.
- `pssepath.add_pssepath(<version>)`
Adds the requested version of PSSE. Remember that specifying a version
number may make your code less portable if you or your colleagues ever use a
different version. `pssepath.add_pssepath(33)`
- `pssepath.select_pssepath()`
Produces a menu of all the PSSE and Python installs on your system,
along with the required version of Python.
If you have set up your system to have the PSSE system files on the system path
at all times, `pssepath` will only use these files.
For information about the PSSE versions installed on your system, either:
- execute the pssepath.py file from windows; or
- run `python -m pssepath.pssepathinfo` You may have to specify the python
install path: ie. `c:\Python25\python -m pssepath.pssepathinfo` or `py.exe
-2.5 -m pssepath.pssepathinfo`
This will provide you with a summary similar to the following::
```
Found the following versions of PSSE installed:
1. PSSE version 32
Requires Python 2.5-32bit (Current running Python)
2. PSSE version XX
Requires Python 2.X-32bit (Installed)
3. PSSE version XX
Requires Python 2.X-32bit
Found the following Python installations:
2.5-32bit (currently running):
PythonCore: C:\Python25\
3.7-64bit:
PythonCore: C:\Users\dan\AppData\Local\Programs\Python\Python37\
```
The status next to the Python version indicates the installation status of the
required Python for the particular PSSE install.
- `Current running Python`
indicates the Python version used to invoke the script
(`c:\Python25\python.exe` if invoked as `c:\Python25\python.exe -m pssepath`) is
appropriate for that version of PSSE.
- `Installed`
indicates that a Python version different to the one used to invoke the
script is required for that PSSE version, but that it is already installed
on your system.
`<nothing>`
The absence of a status means that a different version of Python is
required to run that version of PSSE and it is not installed on your
system. As Python comes bundled with PSSE, this status is unlikely.
Ensuring you use the correct version of Python for the version of PSSE you are
running will avoid seeing `ImportError: Bad magic number...` ever again.
License
--------
This program is released under the very permissive MIT license. You may freely
use it for commercial purposes, without needing to provide modified source.
Read the LICENSE file for more information.
Tips on managing multiple Python versions
-------------------------------------------
I like to use batch files that point to a specific python version. For
example::
```shell
$ more C:\bin\python25.bat
@C:\Python25\python.exe %*
```
Where the PATH includes `c:\bin`. Now you can run python scripts with the
command::
```shell
python25 myscript.py args
```
instead of:
```shell
c:\Python25\python.exe myscript.py args
```
Contributers
--------------
Discussion about this module was conducted at the [Python for PSSE Forum](https://psspy.org/psse-help-forum/question/3/how-do-i-import-the-psspy-module-in-a-python>) involving the following members:
- Daniel Hillier
- JervisW
- Chip Webber
Improvements or suggestions
-----------------------------
Visit the [Python for PSSE Forum](https://psspy.org/psse-help-forum/question/3/how-do-i-import-the-psspy-module-in-a-python>)
See also:
- github: https://github.com/danifus/pssepath
- contact: daniel@whit.com.au
For any other questions about Python and PSSE, feel free to raise them on the
[Python for PSSE Forum](https://psspy.org>)
Raw data
{
"_id": null,
"home_page": "https://github.com/danifus/pssepath",
"name": "pssepath",
"maintainer": null,
"docs_url": null,
"requires_python": ">=2.5",
"maintainer_email": null,
"keywords": "psse extension utility pssepath",
"author": "Daniel Hillier",
"author_email": "daniel.hillier@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9e/6b/989597bdbd15bcffb9fdfa6175c238f38207e5933a5275ffc09b3feee59d/pssepath-0.3.0.tar.gz",
"platform": null,
"description": "\npssepath - Easy PSSE Python coding\n====================================\n\n*author*: whit. (whit.com.au)\n\n`pssepath` simplifies the code required to setup the Python environment necessary\nto use the PSSE API. Using `pssepath` all you have to do is::\n\n```python\n import pssepath\n pssepath.add_pssepath()\n\n import psspy\n```\n\nTested and works on:\n\n- PSSE 32\n- PSSE 33\n- PSSE 34\n- PSSE 35\n\nSupports 32 and 64 bit windows (and provides warnings when using mismatched 64\nbit python when PSSE requires 32 bit python).\n\nUsing this module makes the PSSE system files available for use while avoiding\nmaking modifications to system paths or hardcoding the location of the PSSE\nsystem folders. This makes PSSE easy to use.\n\nWithout `pssepath`, you have to do something like this::\n\n```python\n import os\n import sys\n\n PSSE_LOCATION = r\"C:\\Program Files\\PTI\\PSSE32\\PSSBIN\"\n sys.path.append(PSSE_LOCATION)\n os.environ['PATH'] = os.environ['PATH'] + ';' + PSSE_LOCATION\n\n import psspy\n```\n\nFurthermore, by including `pssepath` with any scripts you distribute, others will\nbe able to use your code without having to edit your code to suit their\nvarying install paths (such as different versions of PSSE).\n\nIt can also provide information about which version of Python to use with a\nparticular install of PSSE to avoid `ImportError: Bad magic number...`.\n\nInstallation\n-------------\n\n`pip install pssepath`\n\nor copy the `pssepath` code directory (the dir that contains `core.py`) to your\nproject's root directory.\n\n\nUsage\n------\n`pssepath` provides 3 methods for setting up the PSSE paths:\n\n\n- `pssepath.add_pssepath()`\n\n Adds the most recent version of PSSE that works with the currently\n running version of Python.\n\n- `pssepath.add_pssepath(<version>)`\n\n Adds the requested version of PSSE. Remember that specifying a version\n number may make your code less portable if you or your colleagues ever use a\n different version. `pssepath.add_pssepath(33)`\n\n- `pssepath.select_pssepath()`\n\n Produces a menu of all the PSSE and Python installs on your system,\n along with the required version of Python.\n\nIf you have set up your system to have the PSSE system files on the system path\nat all times, `pssepath` will only use these files.\n\nFor information about the PSSE versions installed on your system, either:\n\n- execute the pssepath.py file from windows; or\n- run `python -m pssepath.pssepathinfo` You may have to specify the python\n install path: ie. `c:\\Python25\\python -m pssepath.pssepathinfo` or `py.exe\n -2.5 -m pssepath.pssepathinfo`\n\nThis will provide you with a summary similar to the following::\n\n```\nFound the following versions of PSSE installed:\n\n 1. PSSE version 32\n Requires Python 2.5-32bit (Current running Python)\n 2. PSSE version XX\n Requires Python 2.X-32bit (Installed)\n 3. PSSE version XX\n Requires Python 2.X-32bit\n\nFound the following Python installations:\n 2.5-32bit (currently running):\n PythonCore: C:\\Python25\\\n 3.7-64bit:\n PythonCore: C:\\Users\\dan\\AppData\\Local\\Programs\\Python\\Python37\\\n```\n\nThe status next to the Python version indicates the installation status of the\nrequired Python for the particular PSSE install.\n\n- `Current running Python`\n\n indicates the Python version used to invoke the script\n (`c:\\Python25\\python.exe` if invoked as `c:\\Python25\\python.exe -m pssepath`) is\n appropriate for that version of PSSE.\n\n- `Installed`\n\n indicates that a Python version different to the one used to invoke the\n script is required for that PSSE version, but that it is already installed\n on your system.\n\n`<nothing>`\n\n The absence of a status means that a different version of Python is\n required to run that version of PSSE and it is not installed on your\n system. As Python comes bundled with PSSE, this status is unlikely.\n\nEnsuring you use the correct version of Python for the version of PSSE you are\nrunning will avoid seeing `ImportError: Bad magic number...` ever again.\n\nLicense\n--------\nThis program is released under the very permissive MIT license. You may freely\nuse it for commercial purposes, without needing to provide modified source.\n\nRead the LICENSE file for more information.\n\nTips on managing multiple Python versions\n-------------------------------------------\nI like to use batch files that point to a specific python version. For\nexample::\n\n```shell\n$ more C:\\bin\\python25.bat\n@C:\\Python25\\python.exe %*\n```\n\nWhere the PATH includes `c:\\bin`. Now you can run python scripts with the\ncommand::\n\n```shell\npython25 myscript.py args\n```\n\ninstead of:\n\n```shell\nc:\\Python25\\python.exe myscript.py args\n```\n\nContributers\n--------------\nDiscussion about this module was conducted at the [Python for PSSE Forum](https://psspy.org/psse-help-forum/question/3/how-do-i-import-the-psspy-module-in-a-python>) involving the following members:\n\n- Daniel Hillier\n- JervisW\n- Chip Webber\n\nImprovements or suggestions\n-----------------------------\nVisit the [Python for PSSE Forum](https://psspy.org/psse-help-forum/question/3/how-do-i-import-the-psspy-module-in-a-python>)\n\nSee also:\n\n- github: https://github.com/danifus/pssepath\n- contact: daniel@whit.com.au\n\nFor any other questions about Python and PSSE, feel free to raise them on the\n[Python for PSSE Forum](https://psspy.org>)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simplified PSSe python importing",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/danifus/pssepath"
},
"split_keywords": [
"psse",
"extension",
"utility",
"pssepath"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d8630543b11dab6fc718a948d9813a577daca32f9e64d11e2f4c1655392ebf06",
"md5": "7c61e90cee0f20e691f00389aa53fe3d",
"sha256": "70eb83204917b618fdde59cffdf674e6e390a6803c7f24362d87655163486145"
},
"downloads": -1,
"filename": "pssepath-0.3.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7c61e90cee0f20e691f00389aa53fe3d",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.5",
"size": 14000,
"upload_time": "2024-11-13T11:35:06",
"upload_time_iso_8601": "2024-11-13T11:35:06.535520Z",
"url": "https://files.pythonhosted.org/packages/d8/63/0543b11dab6fc718a948d9813a577daca32f9e64d11e2f4c1655392ebf06/pssepath-0.3.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e6b989597bdbd15bcffb9fdfa6175c238f38207e5933a5275ffc09b3feee59d",
"md5": "a2a345358a84456699400f5ae96c5895",
"sha256": "21b7553c11ae7349b8e06f620cb96a776250a3fd68b243f4e906a0ea65d40ae4"
},
"downloads": -1,
"filename": "pssepath-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "a2a345358a84456699400f5ae96c5895",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.5",
"size": 15545,
"upload_time": "2024-11-13T11:35:07",
"upload_time_iso_8601": "2024-11-13T11:35:07.614487Z",
"url": "https://files.pythonhosted.org/packages/9e/6b/989597bdbd15bcffb9fdfa6175c238f38207e5933a5275ffc09b3feee59d/pssepath-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 11:35:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "danifus",
"github_project": "pssepath",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pssepath"
}