Import request and astropy within SharpCap IronPython

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
pe78420
Posts: 23
Joined: Sat Aug 26, 2017 12:09 pm

Import request and astropy within SharpCap IronPython

#1

Post by pe78420 »

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
Jean-Francois
Posts: 863
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Import request and astropy within SharpCap IronPython

#2

Post by Jean-Francois »

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
User avatar
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

#3

Post by admin »

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
pe78420
Posts: 23
Joined: Sat Aug 26, 2017 12:09 pm

Re: Import request and astropy within SharpCap IronPython

#4

Post by pe78420 »

Thanks... I'll try "sys.path.append" on the "site-packages" of my python's 3.13 directory
Post Reply