Forum Discussion

Nadav's avatar
Nadav
Contributor
7 years ago

integrating WHL Python packages

Hi,

as far as i can understand from the documentation and examples here in the community - TC supports integrating external Python libraries using EGG files, which is a very old (since 2004) format.

Since 2012, the format in use is mostly WHL, and many libraries does not offer you the egg files anymore..

I know that there are converting tools, like HUMPTY but they are on a "it worked for me" bases, since no one can guarantee or promises that nothing won't get mixed up from that convert..

Is there a way to use WHL files too?

 

I've tried it with numpy WHL file and it did not work. (can't attach it here for some reason. you can download here: https://pypi.org/project/numpy/#files)

I'm not sure if it didn't work because the WHL is not supported or because of some other stuff (maybe not all external libs can be integrated? see the message from baxatob, 06-21-2017 11:45 AM, in this link(,): https://community.smartbear.com/t5/TestComplete-Mobile-Application/How-do-i-add-Python-Libraries-and-extend-the-Pyton-support-on/m-p/118787#M973)

 

thanks,

Nadav.

  • Nadav's avatar
    Nadav
    7 years ago

    Just to close the loop and save time for future users with the same problem, the solution is as followed:

    1. open the WHL file with 7-zip

    2. extract the folders in it to "C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib\site-packages" folder.

    3. add these lines to the start of your code:

     

    import sys

    sys.path.insert(0, 'C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib\site-packages'

    import <your lib name (in my case: numpy)>

     

    that worked like a charm.

     

    *** credit to Yuriy from SmartBear Customer Care for the solution ***

    • Nadav's avatar
      Nadav
      Contributor

      Yeah,  i read that page many times looking for clues..

      That's why i specified the community examples as well..

      There it's only egg files.

       

      Anyway, this whole procedure is not "normal Python stuff" because this is not how Python external libraries are installed.

       

      Also, like i said - i'm not sure if it's an egg\whl issue, or some other limitation to integrate complected Python libraries..

       

      Is there anyone here who knows how does this import really work?

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        So... what's not working for you?  I've seen folks importing packages here that are WHL so I know that works.  Are you getting errors? If so, what errors?

         

        As for the community example... that's one example where someone is using EGG... Again, others are using WHL so those are working.

         

        so... bit more information from you... what have you attempted (code examples from your TestComplete project would be helpful), version of TestComplete you're using, version of Python, any error messages you're getting, etc.