Hi,
I am trying to create a post logon script which does various tasks,
like setup a printer based on location. While most of it works very
fast, I have a second Python script that I run that scans the PC using
WMI (among other things) and writes the following to a database: Name,
Username, Machine, IP, Login Date,CPU,Memory .
The problem I have is that since I import WMI, it takes a long time
and we have users complaining about it. So I stuck the import
statement into a separate thread and set it to a daemon so it could do
its thing in the background and the rest of the script would finish
and exit.
Unfortunately, I get the following error when I do this:
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python24\li b\threading.py" , line 444, in __bootstrap
self.run()
File "C:\Python24\li b\threading.py" , line 424, in run
self.__target(* self.__args, **self.__kwargs )
File "//serverName/Scripts/PostLogon_MT.py ", line 35, in InvThread
import db_inventory
File "\\serverName\P ythonPackages\U tilities\db_inv entory.py", line
3, in ?
import wmi
File "C:\Python24\li b\site-packages\wmi.py ", line 204, in ?
obj = GetObject ("winmgmts:" )
File "C:\Python24\li b\site-packages\win32c om\client\__ini t__.py",
line 73, in GetObject
return Moniker(Pathnam e, clsctx)
File "C:\Python24\li b\site-packages\win32c om\client\__ini t__.py",
line 88, in Moniker
moniker, i, bindCtx = pythoncom.MkPar seDisplayName(P athname)
com_error: (-2147221020, 'Invalid syntax', None, None)
If I import the module without using threading, it works fine, but
takes forever. Even after it threw that error above, the process
didn't stop and I had to kill it with a control+C.
I am using Windows XP with Python 2.4. Thanks for any help you can
give.
Mike
I am trying to create a post logon script which does various tasks,
like setup a printer based on location. While most of it works very
fast, I have a second Python script that I run that scans the PC using
WMI (among other things) and writes the following to a database: Name,
Username, Machine, IP, Login Date,CPU,Memory .
The problem I have is that since I import WMI, it takes a long time
and we have users complaining about it. So I stuck the import
statement into a separate thread and set it to a daemon so it could do
its thing in the background and the rest of the script would finish
and exit.
Unfortunately, I get the following error when I do this:
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python24\li b\threading.py" , line 444, in __bootstrap
self.run()
File "C:\Python24\li b\threading.py" , line 424, in run
self.__target(* self.__args, **self.__kwargs )
File "//serverName/Scripts/PostLogon_MT.py ", line 35, in InvThread
import db_inventory
File "\\serverName\P ythonPackages\U tilities\db_inv entory.py", line
3, in ?
import wmi
File "C:\Python24\li b\site-packages\wmi.py ", line 204, in ?
obj = GetObject ("winmgmts:" )
File "C:\Python24\li b\site-packages\win32c om\client\__ini t__.py",
line 73, in GetObject
return Moniker(Pathnam e, clsctx)
File "C:\Python24\li b\site-packages\win32c om\client\__ini t__.py",
line 88, in Moniker
moniker, i, bindCtx = pythoncom.MkPar seDisplayName(P athname)
com_error: (-2147221020, 'Invalid syntax', None, None)
If I import the module without using threading, it works fine, but
takes forever. Even after it threw that error above, the process
didn't stop and I had to kill it with a control+C.
I am using Windows XP with Python 2.4. Thanks for any help you can
give.
Mike
Comment