04-21-2021 03:21 PM - last edited on 05-08-2023 10:49 AM by Paul Zimmerman
Hello!
i have a perfectly working python script using Netmiko for connection to the devices and PyAts/Genie to do all the parsing, and it works beautifully, i have my organization devices inventory on an excel spreadsheet and with the script i can loop over all of them and extract information for a specific report... I have pipenv for a virtualenv and WSL2 with ubuntu 20.04 to run everything
But, i need to create a package, a unique file to run the script, using pyinstaller (inside the virtual env and the wsl2 ubuntu 20.04)... I can create the package with some success, but after connecting to the devices i run into the exception of:
Exception: Genie and PyATS are not installed. Please PIP install both Genie and PyATS: pip install genie pip install pyats
This exception is shown for each device connection when it tries to parse the commands.
Everything else in the package is working (the connection to the devices, the reading of the excel spreadsheet and so on...), the scripts loops over the devices and connects to each one but is not parsing the information since genie and pyats are not inside the bundle created by Pyinstaller...
im using this line to run pyinstaller:
pyinstaller --noconfirm --onefile --console --hidden-import="genie" --hidden-import="pyats" "/mnt/c/Users/wil/Documents/MEGA/tp_auto_1.py"
i added the arguments "hidden-import" with genie and pyats but the problem persists... if any help was possible to bring some ligth to the issue would be greeeeatly appreciated...
Best regards and thaaaaaanks in advance if anyone can share an experience bundling a script with pyinstaller and genie/pyats...
06-17-2022 11:37 AM
Have you tried to recreate in a clean virtualenv?
I would install Genie and PyAts in the new one with pip3
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide