python send sms using smspdu

1.4k views Asked by At

I installed python smspdu 1.0 but I have this problem and I don't know how to fix it

>>> from smspdu import SMS_SUBMIT
>>> pdu = SMS_SUBMIT.create('me', '+xxxx', 'hello, world')
>>> pdu.toPDU()
'010016D02B1AEC46ABC562315C4C0600000CE8329BFD6681EE6F399B0C'
>>> pdu = smspdu.SMS_SUBMIT.fromPDU(_, 'sender')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'smspdu' is not defined

the modem is installed correctly because I can send an sms using picocom and at commands

1

There are 1 answers

0
pbacterio On

You have imported SMS_SUBMIT not smspdu.SMS_SUBMIT. Change the last line for:

>>> pdu = SMS_SUBMIT.fromPDU(_, 'sender')