Since upgrading to v28, most of my scripts started failing with an error like this:
Saved screenshot to 'screenshot.png'.
Traceback (most recent call last):
File "/usr/lib/stbt/_stbt/stbt_run.py", line 118, in sane_unicode_and_exception_handling
yield
File "/usr/lib/stbt/stbt-run", line 53, in main
test_function.call()
File "/usr/lib/stbt/_stbt/stbt_run.py", line 99, in fn
execfile(filename, test_globals)
File "/home/rmerlo/STBT/SCRIPTS/PH7YTPLAY_YouTube_Initiate_Playback.py", line 20, in <module>
raise Exception("Error: You forgot to specify the shelf number")
It's at the point in each script where I import a config module/file for the rack/shelf/STB under test, like so:
try:
s = sys.argv[1]
exec('from %s import *'%s)
except:
raise Exception("Error: You forgot to specify the shelf number")
I was able to resolve it by changing that section in all the scripts to a simpler:
shelffile = sys.argv[1]
exec('from %s import *' %shelffile)
although I suspect the fix was not the actual rewrite of the code but maybe the removal of some invalid unicode character(s) that I can't see.
I thought you'd want to know anyway, but do you have any idea why it broke? Is it my fault? As far as I can see, that bit of my scripts is nothing to do with the stb-tester api's, and is just generic python.
FYI, the shelf modules that I import are just a bunch of python variable declarations specific to the rack/shelf/STB under test.