Forum Discussion

Nadav's avatar
Nadav
Contributor
7 years ago

python lib is not recognized as valid win32 app

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.

  • 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:

    https://community.smartbear.com/t5/TestComplete-Desktop-Testing/integrating-WHL-Python-packages/m-p/167379/highlight/true#M12755

     

    chears,

    Nadav.

  • Nadav's avatar
    Nadav
    Contributor

    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:

    https://community.smartbear.com/t5/TestComplete-Desktop-Testing/integrating-WHL-Python-packages/m-p/167379/highlight/true#M12755

     

    chears,

    Nadav.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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,.

    • Nadav's avatar
      Nadav
      Contributor

      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?