orbitcoms
Posts: 57
Joined: Sat Jan 16, 2016 11:12 am

Gammu for Python

Sun Jan 24, 2016 8:10 am

I want to send and receive SMS text message using Python.

So far I have installed gammu and managed to write a script and send SMS to my mobile phone.

The couple of questions I have are:

1. Is there a version of Python-Gammu available for Python 3? (If I run in version 3 the import modules are not found)

2. Can anyone supply a link or code snippet showing how I can detect and incoming SMS and read it?

Thank you

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Gammu for Python

Sun Jan 24, 2016 8:53 am

How did you install it? It looks like it's on PyPi and available for Python 3 so you should be able to install using:

Code: Select all

sudo pip-3.2 install python-gammu
or

Code: Select all

pip-3.2 install --user python-gammu
depending on your preference for installing modules.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

ralfiii
Posts: 2
Joined: Tue Aug 02, 2016 9:50 pm

Re: Gammu for Python

Tue Aug 02, 2016 10:02 pm

I can't install python-gammu like that.
If I try to install with pip or pip3, I get errors:
pi@raspberrypi ~ $ sudo pip install python-gammu
Downloading/unpacking python-gammu
Running setup.py egg_info for package python-gammu
Package gammu was not found in the pkg-config search path.
Perhaps you should add the directory containing `gammu.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gammu' found
....
distutils.errors.DistutilsExecError: command 'pkg-config' failed with exit status 1
Unfortunately I am a Noob and have no clue what to do with that info.

Alternatively I can install python-gammu using "sudo apt-get install python-gammu" - but then python-gammu is available for python2 and not for python3.

Help!!!
Thanks!

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Gammu for Python

Wed Aug 03, 2016 12:18 am

Gammu for Python 3 is only available in Sid or later https://packages.debian.org/search?keyw ... hon3-gammu

So, you have to use Python's package manager `pip3` to try to install it, as you probably don't want to go researching apt-pinning.

Select one of the two options that elParaguayo has posted, copy the code and run. (If you don't know the difference between the two commands, use the one with `--user` in it.)
Account Inactive

ralfiii
Posts: 2
Joined: Tue Aug 02, 2016 9:50 pm

Re: Gammu for Python

Wed Aug 03, 2016 3:53 pm

Ok, I understand that python-gammu is not (yet) available for stable releases of Ubuntu (or, in my case, Mint or Raspbian).
BUT: I don't even manage to install python-gammu into python2 with pip.

To be sure that not an old system is the reason for that, I've just set up a new VM with the most recent version of Mint. (V18).
Then I executed:

Code: Select all

sudo apt-get install python-pip
sudo apt-get install gammu
After that I tried

Code: Select all

sudo pip install python-gammu
pip install --upgrade pip
sudo pip install setuptools
sudo pip install python-gammu
sudo -H pip install python-gammu
pip install python-gammu
pip install --user python-gammu
None of that worked.
It always compains "No package 'gammu' found...
...command 'Pkg-config' failed with exit status 1...
...Command "python setup py egg info" failed with error code 1 in /tmp/pip-build-9wbxXe/python-gammu/

Any ideas?
It's a VM, so no risk in destroying anything, I could run TeamViewer on it in case anyone would be willing to help and take a look...

Thanks,
Ralf

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Gammu for Python

Wed Aug 03, 2016 5:43 pm

If you're trying Python 2 then a simple

Code: Select all

sudo apt-get install python-gammu
will suffice.

https://packages.debian.org/search?keyw ... thon-gammu
Account Inactive

Return to “Python”