linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Linphone and multiprocess under Python


From: Fabrizio Martini
Subject: [Linphone-developers] Linphone and multiprocess under Python
Date: Thu, 2 Feb 2017 15:05:19 +0000 (UTC)

Hi there,

I am developing an application in Python 2.7 that manages several processes running in parallel through multiprocessing.Process python module.
Linphone, should be one of the processes run in parallel to the others.
In this regard, I should inherit the class as follows (as shown in the help of the multiprocess module):

Class Linphone (multiprocessing.Process):
     def __init__(self, username='', password='', whitelist=[], snd_capture='', snd_playback=''):
        self.quit = False
        self.whitelist = whitelist

'''
other attributes and methods definition
'''
 def run(self):
        self.core.invite('sip:address@hidden')
        while not self.quit:
            self.core.iterate()
            time.sleep(0.03)

then in the main() i create an object:

process1=(username='name', password='pwd', whitelist=['sip:address@hidden'],
                          snd_capture='default', snd_playback='default')

The problem occurs when I try to call the start () method (that starts the function / process run () in parallel to other ones):

process1.start()
I receive the following error:
File "/usr/lib/python2.7/multiprocessing/process.py", line 120, in start
    assert self._popen is None, 'cannot start a process twice'
AttributeError: 'Linphone' object has no attribute '_popen'

Also declaring a "dummy" attribute '_popen' I get a further error:
File "/usr/lib/python2.7/multiprocessing/process.py", line 121, in start
    assert self._parent_pid == os.getpid(), \
AttributeError: 'Linphone' object has no attribute '_parent_pid'

Someone can suggest me how to solve this "really-blocking" problem?
Thank you all!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]