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
"Bad DLL calling convention 49..." on Importing UDFs #735
Comments
same issue on my side. |
If you were using the examples from the homepage, I apologize, they hadn't been updated yet, but that's fixed now. I assume you have followed the upgrade guide: http://docs.xlwings.org/en/stable/migrate_to_0.11.html
|
I was about to open a new issue, but I will post here. I have a similar problem, but with the differences:
The file raising the error message has 73 functions, of which 56 have the @xw.func header. All 56 are imported, in spite of the message. Obviously this isn't a big problem for me, but perhaps it might shed some light on the other issues. |
This seems to be a different issue though, @DougAJ4: https://stackoverflow.com/questions/11203020/application-macrooptions-and-error-1004 it looks like the function descriptions are too long. Maybe I should remove the "Make sure you are trusting..." again as this is hardcoded and shown no matter what error ocurrs at the moment. |
Thanks for writing back so promptly, I now have it working on my machine based on these checks. What was wrong in my case should it be of use to sdementen or others: Sorry for my misunderstanding, there is no issue with xlwings in my case and this can be closed from my perspective. Thanks again for the troubleshooting help. |
I thought that long function descriptions was going to be the answer for my problem (MacroOptions method of Application class failed 1004), but it turns out it wasn't. By trial and error I found the function causing the problem was: Possibly the problem is that the function argument must be any array of python complex numbers, which cannot be passed from Excel. This function is not intended to be called from Excel anyway, so I have just deleted the @xw.func, which removes the error message problem. |
I got the same problem as johnmatthewswift, but as Anaconda is the only Python version I got on this pc, I could not resolve the issue using the method he found. Could it be a problem if I do not have administration rights on the pc I am using? |
Also have this issue, it's a new installation so no old versions, I'm using WinPython-64bit-3.5.3.1Qt5. The setting in excel to trust VBA module is set. |
follow the bullet points above. print the xlwings version in the python prompt and make sure it's the same as appears on the addin. |
sorry missed that. how do I fix this? |
upgrade via pip or via the package manager of winpython in your case |
when I uninstalled via pip it seems to have removed the dll files (got the error saying cannot load dll files) using winpython contol panel did reinstall xlwings (via zip file I downloaded) but the dll is still missing |
just a side note when using from command line "python setup.py install" I get an error :"error: can't copy 'xlwings32.dll': doesn't exist or not a regular file" |
I am not familiar with how far the winpython control panel is compatible with setuptools. You can always unzip the xlwings package and manually place the dlls next to python.exe, but I would try pip again as it makes things a lot easier. |
I can't replicate your error message on the dlls but you're right, it doesn't place them in the correct place when installed manually. You should really be using pip. You can also download the package and then do |
got it to work - something went wrong with initial installation, deleted everything and reinstalled Thank you for your help |
Nice! Mine does now the following: I can import UDFs and they appear in the excel spreadsheet, but when in try to use them, they return a "Bad DLL calling convention" in the desired cell. Any ideas how to make it finally work for me? |
Bad DLL calling convention still means that your VBA code (addin) is not in sync with the dlls. Just try to make sure everywhere is 0.11.4 installed. Maybe uninstall the python package first, verify that the dlls are gone (delete them manually if not) and then reinstall the correct version. I assume you do see v0.11.4 on the addin. |
I do have v.011.4 in the ribbon as well as when i check in the python prompt. Sorry, if thats a dumb question, but is there a way to uninstall the python package like you mentioned w/o uninstalling the whole anaconda? And which one is the correct version of python i need then? |
i have been getting the above tried all sugestions still not working working with win10, excel 2016 |
Your 0.11.4 ribbon must be calling the <0.11 dlls. So maybe they were not properly updated when you upgraded xlwings (might happen when they are in use while you update). Try to reinstall xlwings python package. Also make sure you're looking at the right python installation when you have various. I ll be working on proper tools to verify the installation so that we can get rid of these issues in the future. |
i have uninstalled xlwings and reinstalled again now i am getting the run time error 53 cant fined the 32bit dll i have the xlwings32.dll in the anaconda3 directory same place as the python and pythonw.exe files are located. this happens when trying to run import udf or using import file name in the udf.xlsm file why is the programe not finding the file? |
When you do the following in a command prompt, does it point to the directory with the dlls?:
|
yes it does it points to the right directory |
got it to work by using the python path manager in spyder added the Anaconda3 directory to path and all working |
I also have this problem. Not sure if related but I can't see a ribbon either. |
I just updated to 0.11.5 and had a similar problem when first opening an xlwings spreadsheet; UDFs returned "Bad dll calling convention", and the xlwings tab still showed version 0.11.4. I have my Anaconda Python and associated files (including xlwings) installed on my C: drive, but my data files are installed on D:.. \Documents\Spread\xlwings. Excel indicated that the xlwings.xlam file was installed in the Spread\xlwings folder on the D: drive, but there was no xlam file there; so presumably it was deleted in the update process. I copied the new xlwings.xlam from c:\Users\douga\Anaconda2\pkgs\xlwings-0.11.5-py27_0\Lib\site-packages\xlwings\addin\ to the Spread\xlwings folder, and re-started Excel, after which the xlwings UDFs worked again. Note that this is not necessarily the optimal way to do things, but it worked for me. |
closing this as too old. feel free to open a new issue if the error persists. |
I have the latest release of xlwings, 0.11.4, (obtained from pip) and have added the Excel add-in according to the instructions. I am having problems with the Excel add-in menu from the ribbon, and the latest version of the VBA code for 0.11.4.
I've been able to successfully run Example 6 "udf.zip", but I have to manually run the "ImportPythonUDFs" from the VBA code rather than click the "Import Functions" button from the ribbon. Doing so gives me a "Bad DLL calling convention 49..." error.
The bigger problem is that I cannot start a new project using the commands "xlwings quickstart test" or "xlwings quickstart test --standalone" as when I do I cannot import the User Defined Functions either from the ribbon or by manually running the "ImportPythonUDFs" function from the VBA. Both of these now result in the "Bad DLL calling convention 49" error.
The difference seems to relate to changes in the VBA from the version in the example (0.9.3) which is working ok and the VBA from quickstart in the newest version (0.11.4).
The text was updated successfully, but these errors were encountered: