My RPi runs a Raspian wheezy, and I've got python 3.2 installed. I'd like to run this script to make my RPi transmit FM: https://github.com/Make-Magazine/PirateRadio.

I've done git clone https://github.com/Make-Magazine/PirateRadio.git and attempted to start the script with python3.2.

Edit: I got some error messages due to a misplaced pirateradio.conf, which were solved by the answer below, but I have new error messages now, possibly to a misconfigured pifm.

I've installed pifm by unzipping the contents of http://omattos.com/pifm.tar.gz into a folder named pifm and moving it to /root/pifm. Now, when I sudo python3.2 PirateRadio.py, I get the following:

  File "PirateRadio.py", line 176, in <module>
  File "PirateRadio.py", line 31, in main
  File "PirateRadio.py", line 150, in setup
  File "PirateRadio.py", line 156, in run_pifm
    fm_process = subprocess.Popen(["/root/pifm","-",str(frequency),"44100", "stereo" if play_stereo else "mono"], stdin=music_pipe_r, stdout=dev_null)
  File "/usr/lib/python3.2/subprocess.py", line 745, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.2/subprocess.py", line 1371, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 13] Permission denied

Why is the OS not granting permission, to which process, and what can I do to make it run smoothly?


Your config file is probably missing. Make sure the file /pirateradio/pirateradio.conf exists and is a valid config file.

The path is hard coded in the source so if you want to use a different file you will need to edit PirateRadio.py

The reason you this happens is that the program uses ConfigParser.read() to load the configuration which ignores missing files instead of raising an error.

Note: I linked to the Python 2 docs but Python 3 behaves the same way.

| improve this answer | |
  • This was indeed the case. I changed the source to look in the same directory as the PirateRadio.py file. – Roland Jun 7 '14 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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