David
David

Reputation: 53

python send sms using smspdu

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

Upvotes: 0

Views: 1457

Answers (1)

pbacterio
pbacterio

Reputation: 1152

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

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

Upvotes: 1

Related Questions