python-gammu icon indicating copy to clipboard operation
python-gammu copied to clipboard

Command timeout option ?

Open craftpip opened this issue 8 years ago • 2 comments

I have run into a weird problem

this is my code

    .......
    print('GETSMS: 8')

    # try:
    #     sleep(.3)
    #     sms_status = sm.GetSMSStatus()
    #     print(sms_status)
    # except Exception:
    #     print('WOW')

    print('GETSMS: 9')
    # total = sms_status['SIMUsed']
    # print(sms)
    # print(total)
    sms = []
    start = True

    while True:
        try:
            if start:
                current_sms = sm.GetNextSMS(Folder=1, Start=True)
                start = False
            else:
                current_sms = sm.GetNextSMS(Folder=1, Location=current_sms[0]['Location'])

            sms.append(current_sms)
            current_sms_length = len(current_sms)
        except Exception as e:
            print(repr(e))
            current_sms_length = 0

        if current_sms_length == 0:
            print('No messages here')
            break
        else:
            print('Found 1 message')

    linked_sms = gammu.LinkSMS(sms)
    messages = []
    .....

I run this code in a while loop, At first, it works flawlessly, but after a few runs, the program stops working the line "GETSMS: 9" is printed and it stops, is there a timeout i can put to get out of the getNextSMS method ?

Thank you.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

craftpip avatar Oct 17 '17 08:10 craftpip

Additionally, I don't get any exception when it fails,

craftpip avatar Oct 17 '17 08:10 craftpip

You can check debug logs what's going on, see https://wammu.eu/support/bugs/

And what do you get on error if not an exception?

nijel avatar Oct 17 '17 13:10 nijel