New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Import functions" fails with "Could not activate Python COM server, hr = -2147023541" #766
Comments
Update on this issue: The error has gone away again. I can import functions in no-debug mode. I have not the slightest idea what might have changed. I did not change anything between the point in time where it did not work (two days ago) and today. |
Just to clarify: the issue has nothing to do with 32 vs 64 bit. xlwings can cope with all combinations of bitness between OS, Excel and Python as it runs out of process. |
Morning, This post is the closest from what I currently experience (e.g. erratic functioning of UDF functions) so I thought I would add my comment to it even if closed. I currently have the following issue:
Note that:
My configuration is the following:
The only things from that configuration that recently changed are:
Note that I did download the udf.xlsm example from the Xlwings website. This example did not work (same error as the picture above), except (very weirdly) for a brief amount of time (I have no idea why, and when I rebooted my laptop it started to misfunction again). The Fibonnacci example does work without issues. So I guess the issue is really coming from the UDF functions. Further investigations have led me to notice:
Any help appreciated. |
Afternoon, This article suggested that spaces in the Python path might generate issues, so I moved my Winpython folder to the root of my laptop (e.g. C:/winpython/...). This was enough to do the trick. |
thanks for feedback and link! I'll open a separate issue to investigate spaces in the python path. |
same issue. Don't have any spaces in python interpreter. any ideas? |
@dziczekwedrowniczek can you please open a new issue and paste your Traceback. |
I really think this solution should be emphasized and maybe consider to catch this exception when it happens and tell the users that this is exactly what they should do. Thank you very much for this solution @Damrio! |
This refers to issue #764.
I got xlwings to work after installing python32 and pointing the interpreters to this 32 bit installation of python (Anaconda, user installation, no admin rights)
xlwings worked then for a week.
Now it stopped working with the same error as in issue #764.
I uninstalled my Anaconda pythons (32 and 64 bit) and reinstalled only the python32 version. No change.
This time, the problem is even weirder: I can run in debug mode and from the commandline (or pycharm) - no problem, everything works.
The only thing which does not work - and the only thing of importance for a production module - is when I switch from debug mode to no-debug mode. Then, when I hit the "import functions" button of the xlwings ribbon, the error message pops up. When not hitting this button, the error message displays in a cell when running a udf.
I again traced this back to the call to my local python installation:
The last unsuccessful call was in function Py() in xlwings.xlam Main module. Line:
If 0 <> XLPyDLLActivateAuto(Py, XLPyCommand, 1) Then Err.Raise 1000, Description:=Py
Py() was called from sub ImportPythonUDFs() in xlwings.xlam Main Module, line
tempPath = Py.Str(Py.Call(Py.Module("xlwings"), "import_udfs", Py.Tuple(GetUdfModules, ActiveWorkbook)))
which was called from Sub ImportFunctions(control As IRibbonControl) in xlwings.xlam Main Module, line
ImportPythonUDFs
The variable XLPyCommand
is
(no line breaks in the actual variable)
But, actually, the program never executes the call to python (I checked by changing the string and writing to a file).
I am completely at a loss here.
What can I do?
The text was updated successfully, but these errors were encountered: