Re: Problem working with Python 3.10

"quips_roofing.0t--- via Linux-gpib-general" <[email protected]> Thu, 1 Jun 2023 10:26:50 +0930
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <[email protected]>
Hi Michael,

Thanks for your response. 

Pip thinks the module is installed -
pip list |grep gpib
gpib              1.0

However your test code gives me an import error -

File "testing.py", line 6, in <module>
    import gpib
ModuleNotFoundError: No module named ‘gpib'

Pip confirms the package is installed in by venv environment 

"Requirement already satisfied: gpib in ./.venv/lib/python3.10/site-packages/gpib-1.0-py3.10-linux-x86_64.egg (1.0)"

Does the python import path have to be set someway to access the GPIB install?

Lin
Regards,
Chris

> On 31 May 2023, at 9:31 am, Michael K via Linux-gpib-general <[email protected]> wrote:
> 
> What do you get when you run 'pip list'  ....
> [michael@dirac ~]$ pip list |grep gpib
> gpib                   1.0
> [michael@dirac ~]$
> 
> This is an test program that works for me (without any error messages)
> 
> [michael@dirac ~]$ cat GPIBtest.py 
> #! /usr/bin/python3
> ##
> # Include the GPIB extension
> ##
> import gpib
> ##
> # find & initialize the device
> ## (as defined in /etc/gpib.conf)
> device = gpib.find("hp8753c")
> ##
> # write a string to the device
> ##
> gpib.write(device,"IDN?;")
> ##
> # read a 25 byte string
> ##
> result = gpib.read(device,30)
> print ( 'Identifier is: ' + result.decode("ascii") )
> [michael@dirac ~]$
> 
> Where hp9753c is defined in /etc/gpib.conf as ..
> device {
>     minor    = 0            /* minor number for interface board this device is connected to */
>     name     = "hp8753c"    /* device mnemonic */
>     pad      = 16           /* The Primary Address */
>     sad      = 0            /* Secondary Address */
> 
>     eos      = 0xa          /* EOS Byte */
>     set-reos = no           /* Terminate read if EOS */
>     set-bin  = no           /* Compare EOS 8-bit */
>     timeout  = T30s         /* timeout for commands */
> }
> 
> 
> 
> On Sunday, May 28, 2023 at 01:01:40 AM EDT, quips_roofing.0t--- via Linux-gpib-general <[email protected]> wrote:
> 
> 
> Hi all, attempting to use python3 with linux-ppib after successfully using C++.
> 
> 
> 
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general