Hi folks,
I have a Python 3.13 script that calculates the zenith's RA/DEC coordinates based on my GPS position and local time. This script uses the requests and astropy modules.
How can I use it within SharpCap's IronPython environment?
Is there a way to install modules like with pip install?
Or do I need to call my Python 3.13 script from IronPython instead?
Many thanks in advance!
Best regards,
Philippe
Import request and astropy within SharpCap IronPython
-
Jean-Francois
- Posts: 863
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
Re: Import request and astropy within SharpCap IronPython
Hello Philippe,
SharpCap uses IronPython ... that is pure Python with .NET capabilities.
But one limitation is that you can not use C-compiled modules in IronPython.
Example is the module numpy. You can not use it in IronPython. For that you need to use an alternative for C#.
Concerning "pip install" ... no, you can not use this for the installation of a module.
In SharpCap, you can start a script from the IronPython console.
Inside your script, you can start any other Python script that uses any other Python version.
You can find here a lot of my scripts (I'm until today the only one uploading the scripts) viewtopic.php?t=8182
Jean-Francois
SharpCap uses IronPython ... that is pure Python with .NET capabilities.
But one limitation is that you can not use C-compiled modules in IronPython.
Example is the module numpy. You can not use it in IronPython. For that you need to use an alternative for C#.
Concerning "pip install" ... no, you can not use this for the installation of a module.
In SharpCap, you can start a script from the IronPython console.
Inside your script, you can start any other Python script that uses any other Python version.
You can find here a lot of my scripts (I'm until today the only one uploading the scripts) viewtopic.php?t=8182
Jean-Francois
- admin
- Site Admin
- Posts: 17610
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Import request and astropy within SharpCap IronPython
Hi,
yes, Jean-Francois is right that you have to stick to pure .py python stuff if you want to run it inside SharpCap's built in interpreter (you also have access to .NET types, and could bring in a .NET library to if you wanted). If your extra code is pure .py then you can use (I think) sys.path.append('c:\\path\\to\\search') to make the IronPython look in that folder when searching for imports ( I hope I have the backslashes right - maybe it is just single backslashes with single quotes in python?)
cheers,
Robin
yes, Jean-Francois is right that you have to stick to pure .py python stuff if you want to run it inside SharpCap's built in interpreter (you also have access to .NET types, and could bring in a .NET library to if you wanted). If your extra code is pure .py then you can use (I think) sys.path.append('c:\\path\\to\\search') to make the IronPython look in that folder when searching for imports ( I hope I have the backslashes right - maybe it is just single backslashes with single quotes in python?)
cheers,
Robin
Re: Import request and astropy within SharpCap IronPython
Thanks... I'll try "sys.path.append" on the "site-packages" of my python's 3.13 directory