Browse Source

Adding function "print_running_Python_versions()" for ERROR type exits.

RoGeorge 7 years ago
parent
commit
f918bb83a9
2 changed files with 23 additions and 0 deletions
  1. 8
    0
      OscScreenGrabLAN.py
  2. 15
    0
      Rigol_functions.py

+ 8
- 0
OscScreenGrabLAN.py View File

@@ -78,6 +78,8 @@ if len(sys.argv) <= 1:
78 78
 elif sys.argv[1].lower() not in ["png", "bmp", "csv"]:
79 79
     print_help()
80 80
     print "This file type is not supported: ", sys.argv[1]
81
+    print
82
+    print_running_Python_versions()
81 83
     sys.exit("ERROR")
82 84
 
83 85
 file_format = sys.argv[1].lower()
@@ -112,6 +114,8 @@ if instrument_id == "command error":
112 114
     print instrument_id
113 115
     print "Check the oscilloscope settings."
114 116
     print "Utility -> IO Setting -> RemoteIO -> LAN must be ON"
117
+    print
118
+    print_running_Python_versions()
115 119
     sys.exit("ERROR")
116 120
 
117 121
 # Check if instrument is indeed a Rigol DS1000Z series
@@ -120,6 +124,8 @@ if (id_fields[company] != "RIGOL TECHNOLOGIES") or \
120 124
         (id_fields[model][:3] != "DS1") or (id_fields[model][-1] != "Z"):
121 125
     print
122 126
     print "ERROR: No Rigol from series DS1000Z found at ", IP_DS1104Z
127
+    print
128
+    print_running_Python_versions()
123 129
     sys.exit("ERROR")
124 130
 
125 131
 print "Instrument ID:",
@@ -207,6 +213,8 @@ elif file_format == "csv":
207 213
             if stop_point == 0:
208 214
                 data_available = False
209 215
                 print "ERROR: Stop data point index lower then start data point index"
216
+                print
217
+                print_running_Python_versions()
210 218
                 sys.exit("ERROR")
211 219
             elif stop_point < n1:
212 220
                 break

+ 15
- 0
Rigol_functions.py View File

@@ -1,6 +1,21 @@
1 1
 __author__ = 'RoGeorge'
2 2
 
3 3
 import time
4
+import pip
5
+import sys
6
+
7
+
8
+def print_running_Python_versions():
9
+    print "Running Python version:"
10
+    print (sys.version)  # parentheses necessary in python 3.
11
+    print sys.version_info
12
+    print
13
+
14
+    installed_packages = pip.get_installed_distributions()
15
+    installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])
16
+    print "Installed Python modules:"
17
+    print(installed_packages_list)
18
+    print
4 19
 
5 20
 
6 21
 def get_memory_depth(tn):

Loading…
Cancel
Save