Hi,
I have working script that runs on my PC well.
I'm trying to run the same script via TestComplete.
Both my PC and TC are using same version of Python (3.4) and both are 64bit.
But for some reason, when running the script via TC, i get this error message:
ImportError: DLL load failed: %1 is not a valid Win32 application
Now, the import that fails is not of an external lib - i'm trying to import valid working Python lib:
from urllib.request import urlopen
Also, importing just urllib works fine - only when trying to import urllib.request - i get this error.
Googling this issue, i can tell that most offered solutions talks about the library being damaged and needs to be replaced, but since i can run this script via CMD on the same PC - clearly this is not the case.
Any ideas?
Thanks,
Nadav.
Solved! Go to Solution.
If you're using 64-bit TestComplete, you can't call a 32-bit 3rd party library. Run the 32-bit TestComplete that is installed on your system (typically found in C:\Program Files (x86)\SmartBear\TestComplete 12\bin) and try again,.
To solve it for future users with the same problems:
The reason i could not access the Python 3.6 and kept being directed to the 3.4 is that my code used an external library (numpy) that wasn't installed correctly in the TestComplete 3.6, and so, when my code tried to import it - it went to the 3.4 - where the numpy WAS installed.
Installing the numpy corectly on the 3.6 - solved the issue and indeed there is NO issue with having 2 versions of Python on the same PC.
Here is a link for the numpy installation issue:
chears,
Nadav.
If you're using 64-bit TestComplete, you can't call a 32-bit 3rd party library. Run the 32-bit TestComplete that is installed on your system (typically found in C:\Program Files (x86)\SmartBear\TestComplete 12\bin) and try again,.
Hi,
Thanks for the fast replay!
That partially helped..
It turned out that my Python is 32bit and not 64bit, so running the 32bit version of TC solved the win32 error.
But... i get a new error now:
ImportError: Module use of Python34.dll conflicts with this version of Python.
How can i find which version of Python does my TC uses?
As far as i can tell - TC12 uses Python 3.4 as well - could that be wrong?
Maybe it's a 32\64 bit issue?
TC 12 uses Python 3.6
https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html
Is there a way to "downgrade" to 3.4?
I have several scripts on 3.4 that i need to integrate with TC..
TestComplete has it's own installation of Python. So, I don't believe there's an easy way to do that. Your best bet is to convert your code to use Python36 if you want to run it in TestComplete.
I rechecked just to be sure, and urllib.request is also supported in Python 3.6.
Do i need to install the Python 3.6 on my PC or is it part of the TC installation? because i can't see any traces of it in the add\remove programs or on CMD when typing "python".
It's a sub folder installed under the TestComplete bin folder. As mentioned, it's a specific installation that TestComplete uses of Python 3.6.
I'm assuming you're importing a package. Please reference https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html#importing-packages
I would suggest, rather than using your own python path, use what is mentioned about copying your files to the specific folder for TestComplete and importing from there.
well, i do use external packges as well, but urllib is an internal Python library and not external - there is no specific file or installation needed for it.
i did as you advised, looked in the TC installation folder for the urllib folder and specified it's path like this:
urllib_path = 'C:\\Program Files (x86)\\SmartBear\\TestComplete 12\\Bin\\Extensions\\Python\\Python36\\Lib\\urllib' sys.path.insert(0,urllib_path) import urllib.request
and i still get the same error about the Python version being incompatible.
also tried to move the script file i'm calling (that uses the urllib) to the
C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib
folder, instead of leaving it in the project - still the same error.
what i my options (other than removing my Python 3.4 installation and installing 3.6 (which is not really in options)?
is there a way to make it go to the 3.6?
I'm not a Python master... I would, at this point, contact the SmartBear support team directly.
https://support.smartbear.com/message/?prod=TestComplete
Subject | Author | Latest Post |
---|---|---|