[python-win32] Package giving Error while deploying to windows container
Ankit Sharma
sharmaji.ankit777 at gmail.com
Wed May 18 10:41:29 EDT 2022
Hi Team,
Hope this mail finds you well!
The issue with Pywin32 library is , it is getting deployed successfully to
window container, However, once we try to use Export file function from the
library , we get following error:
"Environment:
Request Method: GET
Request URL:
http://globalinnovationfitdjango-window.azurewebsites.net/export_report?projectId=2538
Django Version: 3.0.5
Python Version: 3.8.10
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'corsheaders',
'rest_framework',
'projects',
'channels_menu']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "C:\Python\lib\site-packages\win32com\client\dynamic.py", line 86,
in _GetGoodDispatch
IDispatch = pythoncom.connect(IDispatch)
During handling of the above exception ((-2147221005, 'Invalid class
string', None, None)), another exception occurred:
File "C:\Python\lib\site-packages\django\core\handlers\exception.py",
line 34, in inner
response = get_response(request)
File "C:\Python\lib\site-packages\django\core\handlers\base.py", line
115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python\lib\site-packages\django\core\handlers\base.py", line
113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python\lib\site-packages\django\views\decorators\csrf.py", line
54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Python\lib\site-packages\django\views\generic\base.py", line 71,
in view
return self.dispatch(request, *args, **kwargs)
File "C:\Python\lib\site-packages\rest_framework\views.py", line 505, in
dispatch
response = self.handle_exception(exc)
File "C:\Python\lib\site-packages\rest_framework\views.py", line 465, in
handle_exception
self.raise_uncaught_exception(exc)
File "C:\Python\lib\site-packages\rest_framework\views.py", line 476, in
raise_uncaught_exception
raise exc
File "C:\Python\lib\site-packages\rest_framework\views.py", line 502, in
dispatch
response = handler(request, *args, **kwargs)
File "C:\Python\lib\site-packages\rest_framework\decorators.py", line 50,
in handler
return func(*args, **kwargs)
File "C:\app\backend\manage_products\products.py", line 17683, in
export_report
main()
File "C:\app\backend\manage_products\products.py", line 17854, in main
run_excel(f_path, f_name, sheet_name)
File "C:\app\backend\manage_products\products.py", line 17751, in
run_excel
excel = win32.gencache.EnsureDispatch('Excel.Application')
File "C:\Python\lib\site-packages\win32com\client\gencache.py", line 618,
in EnsureDispatch
disp = win32com.client.Dispatch(prog_id)
File "C:\Python\lib\site-packages\win32com\client\__init__.py", line 117,
in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,
userName, clsctx)
File "C:\Python\lib\site-packages\win32com\client\dynamic.py", line 106,
in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python\lib\site-packages\win32com\client\dynamic.py", line 88,
in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(
Exception Type: com_error at /export_report
Exception Value: (-2147221005, 'Invalid class string', None, None)
"
This is the log that we can not rectify even after updating our python
version and changing container from Linux based environment to Windows
Based environment.
Can you please help us out in figuring this issue out! or can help us in
suggesting if we can deploy this package in a Linux container. Anything
works.
Hope to get a positive answer.
Thanks,
Ankit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220518/69f117d8/attachment.html>
More information about the python-win32
mailing list