I faced with problem when importing several librarys. On first test run everythins works as expected, but if I try to run agait the same routine without re-run testcomplete I get an error.
The problem is that library files was locked by testcomplete process on first run, and they was not released after test is finished.
Here my code:
sys.path.insert(0, Project.Path + '..\\Lib')
sys.path.insert(0, Project.Path + '..\\..\\')
from APItests import LogGenerator
nism_ip = ProjectSuite.Variables.NismIP
falcon_ip = Project.Variables.MARipageURL.split('/')
f = io.StringIO()
sys.stdout = f
sys.stderr = f
Clear all log events on falcon
Function to print in Log.Message the 'print()' statement
output = f.getvalue().split('\n')
for o in output:
On first run of 'clear_logs()' routine it's passed, but on second run there has error:
SystemError: initialization of _psycopg raised unreported exception 9:52:03 Normal 0.00
The script execution was interrupted. 9:52:03 Normal 0.18
TestComplete locks files for psycopg2 and for lxml librarys.
As workaround I found only one solution - rerun testcomplete