Skip to content

Commit 82eb501

Browse files
VISA error handeled in PICA
1 parent 48a9687 commit 82eb501

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

docs/User_Manual.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ This approach, however, leads to a considerable degree of code repetition becaus
8383
>
8484
> Choose one of the following:
8585
> - **NI-VISA:** The industry standard from National Instruments. Download and install it from the [NI website](https://www.ni.com/en/support/downloads/drivers/download.ni-visa.html#575764).
86-
> - **PyVISA-py:** A backend written in pure Python that is installed automatically with PICA. It can be used as a fallback but may have limitations compared to vendor-specific drivers like NI-VISA.
86+
> - **PyVISA-py:** A backend written in pure Python. Install it using `pip install pyvisa-py`. It can be used as a fallback but may have limitations compared to vendor-specific drivers like NI-VISA.
8787
>
88-
> **Before proceeding, verify your VISA installation.**
88+
> **Before proceeding, verify your VISA installation.** For more details and troubleshooting, refer to the "[Common Issues & Troubleshooting](#6-common-issues--troubleshooting)" section.
8989
9090
### 3.2 Getting Started
9191

pica/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
try:
3434
import pyvisa
35+
import pyvisa.errors # Import pyvisa.errors
3536
PYVISA_AVAILABLE = True
3637
except ImportError:
3738
PYVISA_AVAILABLE = False
@@ -1058,6 +1059,11 @@ def _gpib_scan_worker(self):
10581059
except Exception as e:
10591060
result = f"Address: {address}\n Error: Could not get ID. {e}\n\n"
10601061
self.result_queue.put(result)
1062+
except pyvisa.errors.VisaIOError:
1063+
error_msg = (
1064+
"PICA could not find a VISA backend. Please install NI-VISA or run pip install pyvisa-py.\n"
1065+
"Refer to the 'Troubleshooting Installation' section in the documentation for more details.\n")
1066+
self.result_queue.put(error_msg)
10611067
except Exception as e:
10621068
error_msg = (
10631069
f"A critical VISA error occurred: {e}\n"

0 commit comments

Comments
 (0)