'XLWings RunFrozenPython not launching command line
so I have a frozen python script I'm calling main.exe.
I'm using xlwings to launch it from VBA so when I call;
Sub CallMain()
RunFrozenPython ThisWorkbook.Path & "\dist\main\main.exe"
End Sub
I can see in the task manager that it opens main.exe and it appears to be running; I can see the command lines in the task manager and Excel appears to be loading. However, the issue is the CL needs to prompt for the user. The very first line of code that should execute when main.exe runs is:
user = getpass.getuser()
pwd = getpass.getpass("Please enter your password: ")
itemsearch = int(input("How many results do you want?: ")
When I run main.exe as a standalone the command line prompts the user for the inputs then prints the progress to the CL before returning the results to excel.
The programs pretty long but I will tell you the main.py file doesn't have a main(): function it's several function and an import from a class_helpers.py file that defines all of the classes and methods that run in main.py.
But effectively the program works as follow:
'get passwords / user / number of searches',
'import values from column A of sheet',
'iterate over the list of values from column A and create value-objects',
'run a search-method on each object',
'return the results and print them back to excel'
The Python code itself works perfectly. My issue is calling it from VBA as the command line is not appearing when I attempt to run it. So it seems the program is never prompting the inputs for password and results and just hangs at the first line until I end it.
Any ideas what I'm doing wrong with xlwings or the VBA call? The xlwings doc didn't give much detail about the CL prompts or getting user input but I'm still reading through.
Thanks all!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
