COM fails after crash

Hey all,

After experiencing a crash using NeroCOM, I’m having trouble calling GetDrives() function.

The programming langauge is python, but it’s irrelevent:

nero = Dispatch(“Nero.Nero”)
nero.GetDrives(constants.NERO_MEDIA_CD)

I get this exception:
com_error: (-2147352567, ‘Exception occurred.’, (0, ‘Nero.Nero.1’, ‘NeroAPI was not initialized or was unsuccessfully initialized! Make sure that all relevant properties are filled in. Check “LastError” property for possible errors.’, None, 0, -2147220991), None)

and LastError and ErrorLog are both set to ‘Already initialized!’

This doesn’t happen for the first time I use the COM object after restart.

Any suggestion?

Thanks.

The same bug happens after cleanly burning a file, and existing smoothly from the application.

What can be the reason?
Should NeroCOM somehow be uninitalized?

Do you actually experience a crash or just an exception (com error)? Which particular line the error occurrs on?

You say it doesn’t happen for the first time you use the object. Are you saying that you need to restart Windows in order to make it work again?

Do you have two Nero object instantiations in the same program?

I presume Python is an interpreted language? Does it employ a garbage collector?

python is indeed an interpreted language and has a garbage collector. I also posted a message on comp.lang.python regarding this subject.

Anyway, indeed, after each execution I need to restart windows in order to work with com again.

The error occurs when executing GetDrives(), but it also occurs on any other method execution, like APIVersion().
The problem is probably that python somehow doesn’t free/CoUninitializes the nero object, and thus it is left in memory and does not allow further access.
I don’t have two instantiations.

Maybe someone has any suggestion as how to uninitialize a COM object that is left in the memory (so I won’t have to restart so often), at least until I trace the problem?

Do you leave/close your Python environment between two program executions (when the other one fails)?

Can you explicitly release Nero object by assigning null to it (probably not) or perhaps leave the scope of the variable and then force a garbage collection by some language construct (I have found it to be gc.collect())?

Perhaps posting some relevant portions of your code would help?