python - copy.deepcopy() of a _wmi_object results in Exception -


i using wmi 1.4.9 in python, access wmi.

i deepcopy of _wmi_object returned part of wql perform using wmi module in python.

my code shown below,

aproc = wmi.wmi(moniker=self._wmi_namespace).query("select * win32_process name = 'svchost.exe'")[0] copiedproc = copy.deepcopy(aproc) 

but exception, when deepcopy(..) performed.

object.__new__(pyidispatch) not safe, use pyidispatch.__new__() 

i not want maintain reference, instead want object deep copied, before store them , make use of them.

is possible?

pyidispatch cannot copied. objects derivative of idispatch can created new.

if using python wmi module, create new wmi object , copy properties of older object 1 one newer one.

for exaemple, creating new win32_process instance,

newproc = wmi.wmi().win32_process.new() 

then update each property of instance older instance's property.


Comments