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

+ 15
- 0
Rigol_functions.py View File

1
 __author__ = 'RoGeorge'
1
 __author__ = 'RoGeorge'
2
 
2
 
3
 import time
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
 def get_memory_depth(tn):
21
 def get_memory_depth(tn):

Loading…
Cancel
Save