xpra icon
Bug tracker and wiki

Opened 10 months ago

Last modified 2 months ago

#2573 reopened defect

No module named 'comtypes.gen.stdole'

Reported by: stdedos Owned by: stdedos
Priority: trivial Milestone: future
Component: client Version: 3.0.x
Keywords: Cc:

Description

Resurrecting #1899:

"Xpra-Python3-x86_64_4.0-r24952\xpra_cmd" shadow ssh://user@ip/0  --opengl=no --desktop-scaling=0.75 --min-speed=70 --webcam=no --speaker=off --microphone=off --pulseaudio=no --exit-with-client=no

2020-02-03 14:07:25,294 Xpra GTK3 client version 4.0-r24952 64-bit
2020-02-03 14:07:25,294  running on Microsoft Windows 10
2020-02-03 14:07:26,075 GStreamer version 1.16.2 for Python 3.8.0 64-bit
2020-02-03 14:07:26,653 Connected (version 2.0, client OpenSSH_7.2p2)
2020-02-03 14:07:26,731 SSH password authentication failed:
2020-02-03 14:07:26,731  Bad authentication type; allowed types: ['publickey', 'password']
please enter the SSH password for user@ip:
2020-02-03 14:07:41,465 Authentication (password) failed.
2020-02-03 14:07:41,465 SSH password authentication failed:
2020-02-03 14:07:41,465  Authentication failed.
please enter the SSH password for user@ip:
2020-02-03 14:07:54,011 Authentication (password) successful!
2020-02-03 14:07:55,699 Error: failed to query network interface:
2020-02-03 14:07:55,699  No module named 'comtypes.gen.stdole'
2020-02-03 14:07:55,730  keyboard settings: layout=us

Attachments (1)

xpra-2573.txt (28.5 KB) - added by stdedos 10 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 10 months ago by stdedos

2020-02-03 14:35:45,128 Error: failed to query network interface:
2020-02-03 14:35:45,128  module 'comtypes.gen.WbemScripting' has no attribute 'ISWbemLocator'

etc ...

comment:2 Changed 10 months ago by Antoine Martin

Owner: changed from Antoine Martin to stdedos

Originally the bug only occurred with 32-bit builds: ticket:1899#comment:2.
But python-comtypes is so flaky that it looks like it's broken again, even on 64-bit now?

Can you set:

set XPRA_SILENCE_COMTYPES=0

Then run xpra with:

Xpra_cmd -d util ...

This should give a lot more details about what / where things are failing.

Changed 10 months ago by stdedos

Attachment: xpra-2573.txt added

comment:3 Changed 10 months ago by Antoine Martin

Owner: changed from stdedos to Antoine Martin
Status: newassigned

The comtypes bits are here:

2020-02-07 11:49:57,230 Could not import comtypes.gen, trying to create it.
2020-02-07 11:49:57,230 Creating comtypes.gen package failed: [WinError 3] The system cannot find the path specified: 'C:\\Users\\user-win\\Documents\\xpra-clients\\Xpra-Python3-x86_64_4.0-r24952\\lib\\library.zip\\comtypes\\gen'
2020-02-07 11:49:57,230 Created a memory-only package.
2020-02-07 11:49:57,230 Creating writeable comtypes cache directory: 'C:\Users\STAVRO~1.NTE\AppData\Local\Temp\4\comtypes_cache\Xpra_cmd-38'
2020-02-07 11:49:57,230 Using writeable comtypes cache directory: 'C:\Users\STAVRO~1.NTE\AppData\Local\Temp\4\comtypes_cache\Xpra_cmd-38'
2020-02-07 11:49:57,246 Could not import comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2: No module named 'comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2'
2020-02-07 11:49:57,246 # Generating comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2
2020-02-07 11:49:57,277 Could not import comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0: No module named 'comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0'
2020-02-07 11:49:57,293 # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
2020-02-07 11:49:57,324 Could not import comtypes.gen.stdole: No module named 'comtypes.gen.stdole'
2020-02-07 11:49:57,324 # Generating comtypes.gen.stdole
2020-02-07 11:49:57,402 Could not import comtypes.gen.WbemScripting: No module named 'comtypes.gen.WbemScripting'
2020-02-07 11:49:57,402 # Generating comtypes.gen.WbemScripting

This looks like an upstream bug: ModuleNotFoundError: No module named 'comtypes.gen.stdole'

The fix seems to be here: Fix importing newly-created modules on Python 3.

I will try to build a new comtypes package with this patch included.

comment:4 Changed 10 months ago by Antoine Martin

Owner: changed from Antoine Martin to stdedos
Status: assignednew

Created a pull request: comtypes: include patch from upstream to fix missing module errors and I've uploaded a r25179 build with the updated comtypes package.

Does that work better for you? (the error is a race condition - so it may just come and go away on its own..)

comment:5 Changed 10 months ago by stdedos

Apparently, beta is missing the zip packages :/

https://www.xpra.org/beta/windows/?C=M&O=D&P=*r25*.zip*

comment:6 Changed 10 months ago by stdedos

I keep trying to downgrade to get a usable Windows client, but it's not happening - I keep getting flooded with:

2020-02-10 12:51:09,285 Could not import comtypes.gen, trying to create it.
2020-02-10 12:51:09,285 Creating comtypes.gen package failed: [WinError 3] The system cannot find the path specified: 'Xpra-Python3-x86_64_4.0-r24803\\lib\\library.zip\\comtypes\\gen'
2020-02-10 12:51:09,285 Created a memory-only package.
2020-02-10 12:51:09,301 Using writeable comtypes cache directory: '%AppData%\Local\Temp\5\comtypes_cache\Xpra_cmd-38'
2020-02-10 12:51:11,324 Error: failed to receive anything, not an xpra server?
2020-02-10 12:51:11,324   could also be the wrong protocol, username, password or port
2020-02-10 12:51:11,340   or the session was not found
2020-02-10 12:51:11,340 Connection lost

comment:7 Changed 10 months ago by Antoine Martin

Apparently, beta is missing the zip packages :/

Ooops, try now.

This fix is included in the latest 3.0.6 stable release for win32 (r25205).
There are also beta 4.0 ZIP packages now.

I keep getting flooded with:
(..)
2020-02-10 12:51:11,324 Error: failed to receive anything, not an xpra server?

Are you sure that the problem is client side?

comment:8 in reply to:  7 Changed 10 months ago by stdedos

Replying to Antoine Martin:

I keep getting flooded with:
(..)
2020-02-10 12:51:11,324 Error: failed to receive anything, not an xpra server?

Are you sure that the problem is client side?

You are right: probably it hasn't connected at all:

$ ls -lah /run/user/1000/xpra/
total 8,0K
drwx------  2 u u   60 Φεβ  10 15:52 .
drwx------ 14 u u  420 Φεβ  10 15:31 ..

I'll just try with the newest builds; no reason to keep with older builds I guess

comment:9 Changed 10 months ago by stdedos

Blocked on #2588; Xpra-Python3-x86_64_4.0-r24762 gives:

2020-02-11 21:21:52,905 Could not import comtypes.gen, trying to create it.
2020-02-11 21:21:52,909 Creating comtypes.gen package failed: [WinError 3] The system cannot find the path specified: 'Xpra-Python3-x86_64_4.0-r24762\\lib\\library.zip\\comtypes\\gen'
2020-02-11 21:21:52,913 Created a memory-only package.
2020-02-11 21:21:52,917 Creating writeable comtypes cache directory: '%AppData%\Local\Temp\6\comtypes_cache\Xpra_cmd-38'
2020-02-11 21:21:52,921 Using writeable comtypes cache directory: '%AppData%\Local\Temp\6\comtypes_cache\Xpra_cmd-38'
2020-02-11 21:21:52,961 Could not import comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2: No module named 'comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2'
2020-02-11 21:21:52,965 # Generating comtypes.gen._565783C6_CB41_11D1_8B02_00600806D9B6_0_1_2
2020-02-11 21:21:53,013 Could not import comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0: No module named 'comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0'
2020-02-11 21:21:53,017 # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
2020-02-11 21:21:53,069 Could not import comtypes.gen.stdole: No module named 'comtypes.gen.stdole'
2020-02-11 21:21:53,069 # Generating comtypes.gen.stdole
2020-02-11 21:21:53,153 Could not import comtypes.gen.WbemScripting: No module named 'comtypes.gen.WbemScripting'
2020-02-11 21:21:53,157 # Generating comtypes.gen.WbemScripting
2020-02-11 21:21:56,009 enabled remote logging
2020-02-11 21:21:56,009 Xpra GTK3 shadow server version 3.0.6-r25174 64-bit
2020-02-11 21:21:56,025  running on Linux Ubuntu 16.04 xenial

comment:10 Changed 10 months ago by Antoine Martin

Blocked on #2588

IIRC, the latest 3.0.6 release builds also have this fix.

Xpra-Python3-x86_64_4.0-r24762 gives:

That's older than the fix.
That said, there's no error in that output, which can happen since the bug was a race condition in python-comtypes.

comment:11 Changed 10 months ago by stdedos

Resolution: fixed
Status: newclosed

Seems that Xpra-Python3-x86_64_4.0-r25205 is working all of a sudden :/

Also, this is now fixed.

comment:12 Changed 9 months ago by totaamwin32

Resolution: fixed
Status: closedreopened

It's happening again, and it looks like a comtypes bug:

2020-03-12 15:40:02,807 Could not import comtypes.gen, trying to create it.
2020-03-12 15:40:02,807 Creating comtypes.gen package failed: [WinError 3] The system cannot find the path specified: 'E:/Xpra/trunk/src/dist/lib/library.zip/comtypes/gen'
2020-03-12 15:40:02,807 Created a memory-only package.
2020-03-12 15:40:02,807 Using writeable comtypes cache directory: 'C:/Users/WIN7PR~1/AppData/Local/Temp/comtypes_cache/xpra_cmd-38'
2020-03-12 15:40:02,823 get_interface_info({DDE35DAB-A010-4150-B02D-6C4191D81842})
Traceback (most recent call last):
  File "E:\Xpra\trunk\src/xpra/platform/win32/netdev_query.py", line 18, in get_interface_info
    o = CreateObject("WbemScripting.SWbemLocator")
  File "C:/msys64/mingw64/lib/python3.8/site-packages/comtypes/client/__init__.py", line 250, in CreateObject
    return _manage(obj, clsid, interface=interface)
  File "C:/msys64/mingw64/lib/python3.8/site-packages/comtypes/client/__init__.py", line 188, in _manage
    obj = GetBestInterface(obj)
  File "C:/msys64/mingw64/lib/python3.8/site-packages/comtypes/client/__init__.py", line 112, in GetBestInterface
    interface = getattr(mod, itf_name)
AttributeError: module 'comtypes.gen.WbemScripting' has no attribute 'ISWbemLocator'
2020-03-12 15:40:02,823 Error: failed to query network interface:
2020-03-12 15:40:02,823  module 'comtypes.gen.WbemScripting' has no attribute 'ISWbemLocator'

Because calling CreateObject("WbemScripting.SWbemLocator") should work: SWbemLocator.ConnectServer method.
The same code does work from an MSYS2 shell:

>>> from comtypes import CoInitialize
>>> CoInitialize()
>>> from comtypes.client import CreateObject        #@UnresolvedImport
>>> o = CreateObject("WbemScripting.SWbemLocator")
>>> o
<POINTER(ISWbemLocator) ptr=0x9ff13d0 at 9f10e40>

So maybe it's just not happy when running from a memory-only package?

Unfortunately, python-comtypes is not very active at all, no releases since 2018...
So maybe we'll have to use something else.

For now, r25617 makes this error less scary.

Last edited 9 months ago by Antoine Martin (previous) (diff)

comment:13 Changed 9 months ago by Antoine Martin

Milestone: 4.04.1

out of time

comment:14 Changed 2 months ago by Antoine Martin

Milestone: 4.1future

Not much happening with comtypes..

Note: See TracTickets for help on using tickets.