Re: [python-win32] Package giving Error while deploying to windows container

2022-05-19 Thread Tim Roberts

On 5/19/22 05:40, Vernon D. Cole wrote:

Django also runs on Windows, and I have operated it there for testing 
purposes, but it is most at home in a Linux environment.
I have never (personally) run it in a container. I prefer the better 
performance and ease of use when installed directly on the server. 
Containers may deploy more quickly, but you pay a penalty for the rest 
of the life of the system.
I cannot imagine why one would want to run * anything * in a Windows 
container. That is adding complexity on top of difficulty.
My suggestion is to eliminate Windows from your thinking and run 
django directly on Linux.


However, this is not very good advice for an application that is 
invoking Microsoft Excel to do its work.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Package giving Error while deploying to windows container

2022-05-19 Thread Vernon D. Cole
Django also runs on Windows, and I have operated it there for testing
purposes, but it is most at home in a Linux environment.
I have never (personally) run it in a container. I prefer the better
performance and ease of use when installed directly on the server.
Containers may deploy more quickly, but you pay a penalty for the rest of
the life of the system.
I cannot imagine why one would want to run * anything * in a Windows
container. That is adding complexity on top of difficulty.
My suggestion is to eliminate Windows from your thinking and run django
directly on Linux.
Use Windows for desktops or laptops, use Linux for servers.
(full disclosure: this message is being typed on an Ubuntu Linux desktop.)


On Wed, May 18, 2022 at 3:49 PM Ankit Sharma 
wrote:

> 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 

Re: [python-win32] Package giving Error while deploying to windows container

2022-05-18 Thread Dennis Lee Bieber
On Wed, 18 May 2022 20:11:29 +0530, Ankit Sharma
 declaimed the following:


>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.
>

I have no idea of how this "container" operates. Can you produce a
stand-alone console test case to run in this "container" rather than all
the overhead of django? In fact, you are losing much of the real error
traceback as it appears django is only showing the last call, and then
dumps a second traceback because your framework errored.

Until the test case runs in a console I'd avoid any web-based
operations. Actually -- I'd avoid even the "container" system until the
test case runs on a local desktop machine.

Does your "container" have a licensed copy of Excel?

>
>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.
>

To my knowledge pywin32 is a Windows Only library -- it might run under
WINE on a Linux system. Oh... And Excel is also not a Linux application to
my knowledge -- there may be a MacOS version available.

I suspect you will need to find/use one of the Excel reader/writer
packages that DOES NOT REQUIRE Excel to be present, only an .xls/.xlsx file
(OpenPyXL ?). You will likely also need a package that can produce reports
probably to PDF or HTML Reportlab appears to only generate PDF output --
okay for export/download, but not for inline display on a web page (of
course, if you are using django, you should have a templating engine and
should be able to code the web display report using it).



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Package giving Error while deploying to windows container

2022-05-18 Thread Tim Roberts

Ankit Sharma wrote:
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:

...
  File "C:\app\backend\manage_products\products.py", line 17751, in 
run_excel

    excel = win32.gencache.EnsureDispatch('Excel.Application')
...
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.


You are trying to run the Excel application.  To do that, you have to 
have Excel installed on the machine where you're running. And, of 
course, nothing that uses Win32Com can ever work on Linux.


If you're trying to manipulate Excel files, there are many 
cross-platform libraries to do that.  If you really need to RUN Excel, 
then it has to be on Windows, and you have to have Excel installed.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.



smime.p7s
Description: S/MIME Cryptographic Signature
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Package giving Error while deploying to windows container

2022-05-18 Thread Ankit Sharma
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
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32