473,229 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,229 software developers and data experts.

pythoncom, CoUninitialize & references

Hey,

I'm programming something with NeroSDK COM module, and I bumped into a
problem:
why doesn't python releases and uninitializes COM objects that are no
longer referenced?

Here is a sample code:
# start of sample code
from win32com.client import *

nero = None

def find_backpack_cd():
drives = nero.GetDrives(constants.NERO_MEDIA_CD)
rc = None
for d in drives:
if d.DeviceName.find("BACKPACK") != -1:
rc = d
break
del(drives)
print rc
return rc

def main():
global nero
nero = Dispatch("Nero.Nero")
cd = find_backpack_cd()
del(cd)
del(nero)

if __name__ == "__main__":
main()
print pythoncom._GetInterfaceCount()
pythoncom.CoFreeUnusedLibraries()
pythoncom.CoUninitialize()

# end of sample code

the problem is as follows, if for example, I remove the line
'del(nero)' in function main(), the _GetInterfaceCount() is 1 and
CoUninitialize() fails.
And if I remove the explicit call to CoUninitialize() (and the
interface count is greater than 0) the next time I run the program it
fails with exception that the neroAPI is already initialized (deducing
that it is somehow still in memory).

Doesn't python should get rid of all instances of the COM objects
through its garbage collector?
Thanks,
Omer.
Jul 18 '05 #1
0 2307

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
Hi I'm trying to build a standalone COM exe server using Python 2.2 + Mark Hammond's windows extensions + Py2Exe. I've built the example linked on the Py2Exe homepage and get this error when...
5
by: Brian Hlubocky | last post by:
I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without...
6
by: gcmartijn | last post by:
H! I using a script that opens a internet page in a small window (what I can control) In XP everything was working fine, but now I'm using Vista with IE7 and this is what happends now: First...
0
by: Gabriel Genellina | last post by:
En Wed, 27 Aug 2008 21:17:22 -0300, Vistro <vistro@vistro.netescribi�: Reinstalling the pywin32 package should fix that, I presume. In fact that __import_whatever function does a rather...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.