I am trying to follow the following tutorial: http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter

I created a folder to put the module in and went to the directory with:

mkdir pifm
cd pifm

Then I downloaded and extracted the module with

wget http://omattos.com/pifm.tar.gz
tar xvfz pifm.tar.gz

and now I tried to type sudo python in IDLE and the terminal (I didn't know where to type it) both seemed to do nothing but okay.

Then I typed in IDLE

import PiFm

And I get an error: PiFm is not defined

If however I type pifm.play_sound(...) I get that pifm has no attribute named play_sound.

I used latest version of raspbian, raspberry pi 1 and IDLE 3

Thank you, Most of the credit for this post goes to the user at stackoverflow MrHug, but since that was the wrong forum the thread was closed. You can see it here https://stackoverflow.com/questions/34291947/how-to-install-a-python-module-in-raspbian

Thanks in advance everyone

1 Answer 1


The pwd command will show your current directory. The ls command will show files in your current directory.

Is pifm.py in your current directory?

If not either cd to the directory containing pifm.py or cp (copy) pifm.py to your current directory.

The module should then be found by Python.

  • I usually ignore any posts on pifm. It is illegal and potentially causes interference. It may be "clever" but should not be encouraged.
    – Milliways
    Commented Dec 16, 2015 at 11:08
  • @Milliways That's your choice. I have seen no evidence that pifm is illegal in any or all jurisdictions.
    – joan
    Commented Dec 16, 2015 at 11:13
  • I am the creator of this topic. I had to create this account. I extracted the module in the pifm folder I made with mkdir and then went to the directory with cd pifm (as I had stated?) This means that pifm.py is in home/pi/pifm but what does typing cd pifm in the terminal change the fact that idle gives me errors. And also to everyone commenting that this is illegal, I do not live in the US and this transmitter would go max 100m on a frequency no radio station uses. I don't see the problem.
    – user260837
    Commented Dec 16, 2015 at 11:26
  • So what is reported by ls in your working directory?
    – joan
    Commented Dec 16, 2015 at 11:36
  • In Australia (and I believe UK and US if not all ITU signatories) ANY unlicensed broadcast on the "broadcast band" (which varies between jurisdictions) is illegal. I believe this is part of the WRC agreements. There are bands reserved for "class licensed" low power transmissions, but this wouldn't even qualify.
    – Milliways
    Commented Dec 16, 2015 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.