python - Non-error message from another script when importing library -


i produced strange error today, using python 2.7 on windows 10 system. wrote python script, c:\users\$me\copy.py looking this:

import subprocess import sys  try:     out = subprocess.check_output("do_stuff.bat") except subprocess.calledprocesserror e:     print "doing stuff failed."  do_stuff_did_something = out.find("string found in do_stuffs output.") if do_stuff_did_something == -1:     print "do_stuff didn't it." else:     print "do_stuff did it." 

so far, good, works fine , it's supposed do: run batch file, specific string in output, , return message according whether found string or not.

some time afterwards, installed openopc library. @ point don't remember, started happening:

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" more information. >>> import openopc do_stuff did it. >>> 

this happens if run python script.py including openopc import. not happen other libraries (that tried). , it's not error message since openopc works fine. i'm afraid somehow messed might catch me later.

i couldn't find clue in openopc.py when message might printed.

the error persists after rebooting.

so happened here? how can fix it?

it's possible script getting imported before (or because python thinks part of) openopc library. script chance called openopc.py or similar, or reside in package/folder hierarchy?

alternatively, did save original script? in package/module hierarchy of openopc? might trigger load in unusual cases.

lastly: error behavior reoccur if run python somescript.py (where somescript.py not 1 containing script content @ top of question) new/different directory 1 you've been running from?

all of tweaks try isolate problem away situation in script getting interpreted part of openopc module. that's unusual situation in, possible; if problematic behavior goes away due of steps, move/rename script.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -