Today I issued a very strange error using Python 2.7 on Windows 10. I wrote a Python script C:\Users\$me\copy.py, looking something like this:
import subprocess
import sys
try:
out = subprocess.check_output("do_stuff.bat")
except subprocess.CalledProcessError as e:
print "Doing stuff failed."
do_stuff_did_something = out.find("String to be found in do_stuffs output.")
if do_stuff_did_something == -1:
print "Do_stuff didn't do it."
else:
print "Do_stuff did do it."
So far, so good, it works fine and does what it should do: run a batch file, find a specific line in your output and return a message depending on whether it found the line or not.
After a while, I installed the OpenOPC library. At some point that I don’t remember, it started:
C:\Users\$me>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenOPC
Do_stuff did do it.
>>>
, python script.py, OpenOPC. ( ). , OpenOPC . , - , .
OpenOPC.py, .
.
? ?