xlwings 0.23.2 - Run-time error '53': File not found - python

I changed my conda system from anaconda to miniconda. Everything was working normally with anaconda but after the change xlwings stopped working.
Now I am getting the following error Run-time error '53': File not found.
On debugging through the VBA interface, I found that the routine was searching in the folder C:\Users\USERNAME\AppData\LocalTemp\ (not the project's folder) and coming up with a very long .log filename which changes each time I attempt to run it (eg. xlwings-374ABEE7-4C51-8622-AB5B-D42C5294C2B8.log)
Is this a bug which needs to be corrected? or have I done something incorrectly?
System: Windows 10; MS Office 365; xlwings ver: 0.23.2

I had a similar issue that drove me crazy.
After hours of debug and testing, I randomly click on the RunPython: Use UDF server checkbox and it worked

Related

Unable to import modules in pycharm in spite being installed in the used python interpreter

Even after installing dash - getting module import error.
Pycharm does not throw any compilation errors on the line as well.
How could this be resolved?
I tried everything as suggested in comments and stuff known to me but could not resolve this - have done this a thousand times earlier but don't know what went wrong this time.
The only solution the=at worked was to create a new project, copy files over manually and then create a fresh interpreter and VE.

cannot load CSVs or Excel files after some updates

I was trying to schedule a new python code by running with a BAT file, but was getting an error that the statsmodels package was not present. The package loaded fine in Spyder, but not when running from a BAT file. I followed a thread here that suggested updating my packages in console (pip command) which I did.
That led to a new error that NumPy was not loading. I noticed that I now had 2 versions of NumPy (1.19.1 and 1.19.2). Further searches yielded advise to uninstall and reinstall NumPy. I had to uninstall twice to get rid of both versions, then installing left me with 1.19.2.
Now, when I run my code in Spyder, I get a strange error on pd.read_csv:
"Only callable can be used as callback"
I couldn't find anyone getting this error from pd.read_csv. Next, I tried to run pd.read_excel in Spyder, but I get this error message:
"int() argument must be a string, a bytes-like object or a number, not '_NoValueType'"
This is code that worked fine yesterday on files that have not changed, so it is not the files. I even made a couple test files and get the same error. Trying to load statsmodels in Spyder now fails:
"from statsmodels.tsa.ar_model import AutoReg"
"AttributeError: module 'numpy.core' has no attribute 'records'"
Running the same code in BAT, reading csv and excel files DO work, but still hangs up on loading statsmodels.
I think at this point, I need to reload Anaconda, but I don't understand why code that works in Spyder does not work running from BAT file, when I am referencing the only copy of python that I have in Anaconda.
Thanks,
It seems to be fine today, so perhaps I needed a full reboot to implement the updates? I don't remember doing this in the past.
I'm still having the original issue with loading the statsmodels package when running from BAT file, but I will ask that in a new post.

Got errors, while running exe file built with pyinstaller and Google Cloud API integration in python

I am working one file python project.
I integrated google-cloud-API for realtime speech streaming and recognition.
It works with python aaa.py command well.
Now I need windows build file(.exe), so I used pyinstaller program and I got aaa.exe file successfully.
But I got this error while running speech streaming by using Google cloud API.
[Errno 2] No such file or directory:
'D:\AI\ai\dist\AAA\google\cloud\gapic\speech\v1\speech_client_config.json'
So I copied this speech_client_config.json file in needed path, after that I got below error again.
Exception in 'grpc._cython.cygrpc.ssl_roots_override_callback'
ignored E0511 01:13:14.320000000 3108
src/core/lib/security/security_connector/security _connector.cc:1170]
assertion failed: pem_root_certs != nullptr
Then, I can not find solution to get working version with google-cloud API.
I am using python version 2.7.14
I need your friendly help.
Thanks.
I had the same problem. If you are willing to distribute roots.pem with your executable (just search for the file - it should be buried deep within the installation directory of grpcio), I had luck fixing this by setting GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable to the full path of this roots.pem file.
Update 2021
To anyone who is experiencing this issue. I got it working thanks to these amazing people. See the full conversation on this github issue.
Here is the link
Step 1
Credits to #cbenhagen & #rising-stark on this github link.
A PyInstaller hook called hook-grpc.py looking like this would do the trick:
Create a python file named hook-grpc.py with this code.
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('grpc')
Step 2
Put the hook-grpc.py file in your \site-packages\PyInstaller\hooks directory of the python environment you are running on. So basically you can find it at
C:\Users\yourusername\AppData\Local\Programs\Python\Python37\Lib\site-packages\PyInstaller\hooks
Note:
Just change the yourusername and Python37 to your
respective username and python version you are using.
For Anaconda users it might be different. Check this site
to find the anaconda python environment path you are using.
Step 3
Once you've done that you can now convert your .py python program to .exe using pyinstaller and it should work.
This looks to me like a SSL credentials mistake. I think you are not being allowed to GC. Check this code snippet and this documentation.

Python 3.3.5 time module missing

When I try to import time I get : No module named time
I have tried other time modules(datetime and timeit) and they work fine. I decided to check my installation and I can't find time.py anywhere. I checked the Lib, Scripts, libs and include folders, but can't find it anywhere.
Anyone know what I can do to fix this? Maybe download the .py and put it in Lib myself?
I am using Python 3.3.5 with PyCharm IDE. Only extra scripts I've installed is EasyInstall and PRAW.
The import does work. When PyCharm said No module named time, I assumed I would get a compiler error and started trying to fix it.
However when I eventually just ran the code it worked fine. I expect PyCharm doesn't detect the time module as it's a dll and not a py as noted by Martijn in the comments. This is on PyCharm Community Edition 4.0.4.
I tried playing with virtualenv and a host of other things, but I eventually went to Preferences -> Build, Execution, Deployment -> Console -> Python Console, and in the "starting script" box, I added two lines:
sys.builtin_module_names.append('sys')
sys.builtin_module_names.append('time')
This got rid of errors I had with both sys and time. Once I did that, I even get autocomplete for both of those modules... weird.

Correct mt.exe syntax to resolve pyodbc import problems

I'm deploying a Python app on Windows for the first time (Apache & mod_wsgi/Flask/Sqlalchemy).
I'd like to use pyodbc to get Sqlalchemy talking to mssql.
I was able to install a binary build of pyodbc with no problem, and it works when I use it from the command line. However, mod_wsgi is logging import errors when it hits import pyodbc
This thread on the pyodbc issue tracker describes my issue exactly, and seems to implicate Windows manifests. However, I can't figure out how to use mt.exe to resolve it.
In PowerShell:
C:\my\site-packages> C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\mt.exe
-inputresource:c:\Windows\SysWOW64\python27.dll;#2 -manifest
-outputresource:pyodbc.pyd#2'
mt.exe : command line error c10100a9: Some operation on the input manifests must
be specified (even if it is just to pipe the input to the output).
Use the /? option for help on usage and samples.`
In cmd:
C:\my\site-packages>"C:\Program Files\Microsoft SDKs"\Windows\v7.1\Bin\mt.exe
-inputresource:C:\Windows\SysWOW64\python27.dll#2 -outputresource:pyodbc.pyd#2
mt.exe : general error c101008c: Failed to read the manifest from the resource
of file "C:\Windows\SysWOW64\python27.dll#2". The system cannot find the file
specified.
What am I doing wrong?!
I'm the author of the thread on the pyodbc issue tracker.
Unless I'm missing something it looks like the file "C:\Windows\SysWOW64\python27.dll" doesn't exist. Maybe you have a version other than 2.7?
Otherwise, make sure you have installed the official windows packages for python and verify that importing pyodbc succeeds with that version. If it does, you should be able to substitute the path to your local python.dll (e.g. python27.dll) from the python installation root or elsewhere.
Well, this is embarrassing: I appear to be missing some semicolons. I know that I'd run the command properly at least a few times though, so I will list the other things I changed before noticing the mistake in the syntax:
Made triply sure everything was 32-bit
Downloaded Visual Studio C++ 2008 Express (was just running VC++ 2008 redistributable before, and this gave me a different version of mt.exe)
Uninstalled anything with "2010" and "C++" in its name
Ran the command in cmd; for whatever reason, it does not work at all in PowerShell.
Thanks again to Alfred for his epically detailed and helpful post over at the pyodbc mailing list.

Categories