Menu

Using hamlib in a python program

Help
2021-04-21
2021-04-21
  • Meissam Ramazani

    Hello

    Sorry if this a newb question.
    I looked on a tutorial on how to make the hamlib commands work from within my python program (python v3.8)
    but I'm not finding anything that helped me.
    I installed the hamlib 4.1 on my windows machine and the commands work from the command prompt.
    I am able to control my rotator from the command prompt but how do I do this with python? Is this possible? I found a module called hamlib.py and when I try to import that it says:

      File "C:\Users\JumpStart\anaconda3\lib\Hamlib.py", line 5, in <module>
        import _Hamlib
    ModuleNotFoundError: No module named '_Hamlib'
    

    I don't have a module called _Hamlib anywhere on my system.

    Thank you for any help it would be so appreciated.
    Mesi

     

    Last edit: Meissam Ramazani 2021-04-21
    • Michael Black

      Michael Black - 2021-04-21

      In the bindings directory you'll find py3test.py which should get you started.
      Mike W9MDB

      On Wednesday, April 21, 2021, 05:49:56 AM CDT, Meissam Ramazani <ramazanimeissam@users.sourceforge.net> wrote:
      

      Hello

      Sorry if this a newb question.
      I looked on a tutorial on how to make the hamlib commands work from within my python program (python v3.8)
      but I'm not finding anything that helped me.
      I installed the hamlib 4.1 on my windows machine and the commands work from the command prompt.
      I am able to control my rotator from the command prompt but how do I do this with python? Is this possible?

      Thank you for any help it would be so appreciated.
      Mesi

      Using hamlib in a python program

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/hamlib/discussion/25919/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
      • Meissam Ramazani

        Thanks Michael,
        I try to do that but the file throws an error.

        C:\Users\JumpStart\anaconda3\python.exe C:/Users/JumpStart/PycharmProjects/Astrocast/GUI/py3test.py
        Traceback (most recent call last):
          File "C:/Users/JumpStart/PycharmProjects/Astrocast/GUI/py3test.py", line 12, in <module>
            import Hamlib
          File "C:\Users\JumpStart\anaconda3\lib\Hamlib.py", line 5, in <module>
            import _Hamlib
        ModuleNotFoundError: No module named '_Hamlib'
        
        Process finished with exit code 1
        
         
        • Michael Black

          Michael Black - 2021-04-21

          Python bindings for Windows has been a headache.
          It's on my todo list to see if we can't provide them in the downloads but haven't done it yet.
          Did you build hamlib yourself?
          If you did can you try with this configure switch.
          --with-python-binding

          Mike W9MDB

          On Wednesday, April 21, 2021, 08:03:46 AM CDT, Meissam Ramazani <ramazanimeissam@users.sourceforge.net> wrote:
          

          Thanks Michael,
          I try to do that but the file throws an error.
          C:\Users\JumpStart\anaconda3\python.exe C:/Users/JumpStart/PycharmProjects/Astrocast/GUI/py3test.py
          Traceback (most recent call last):
          File "C:/Users/JumpStart/PycharmProjects/Astrocast/GUI/py3test.py", line 12, in <module>
          import Hamlib
          File "C:\Users\JumpStart\anaconda3\lib\Hamlib.py", line 5, in <module>
          import _Hamlib
          ModuleNotFoundError: No module named '_Hamlib'</module></module>

          Process finished with exit code 1

          Using hamlib in a python program

          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/hamlib/discussion/25919/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

           

Log in to post a comment.