title: "ImportError: No module named omxplayer.player" when running Python Script from Command Prompt
body: <p>I wrote a simple script to play a random video when a button is pressed on raspberry pi. It works fine with the built in Raspberry Pi Python 3 IDE. Runs just like it should</p>
  
  <pre><code>import RPi.GPIO as GPIO
  import random
  import os
  import sys
  from time import sleep
  from subprocess import call
  from omxplayer.player import OMXPlayer
  
  #Uses the board pin number
  GPIO.setmode(GPIO.BOARD)
  
  #Delays
  Skip_Wait_Time = 1
  Genre_Wait_Time = 3
  Next_Movie_Wait_Time= 4
  
  
  #Pin Numbers
  Button1_Pin = 35
  Button2_Pin = 33
  Button3_Pin = 23
  Button4_Pin = 24
  
  ShutdownButton_Pin = 21
  QuitButton_pin = 37
  
  #Sets Up the 4 GPIO Pins with pull ups
  GPIO.setup(Button1_Pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(Button2_Pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(Button3_Pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(Button4_Pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(ShutdownButton_Pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(QuitButton_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  
  #Action
  Genre1 = ("/home/pi/Videos/ActionMovies/")
  
  #Comedy
  Genre2 = ("/home/pi/Videos/ComedyMovies/")
  
  #Sitcoms
  Genre3 = ("/home/pi/Videos/Sitcoms/")
  
  #Drama
  Genre4 = ("/home/pi/Videos/DramaMovies/")
  
  #Christmas
  Genre5 = ("/home/pi/Videos/ChristmasMovies/")
  
  #Button States
  Button1_State = True
  Button2_State = True
  Button3_State = True
  Button4_State = True
  
  ShutdownButton_state = True
  QuitButton_state = True
  
  #variable
  Current_Genre = "Genre1"
  Current_Genre_Directory = "Null"
  Current_Movie_Path = "Null"
  episode= "Null"
  Time_Remaining = 2
  elapsed = 0
  Button_Pressed = False
  
  
  
  
  #-------------------------------------------
  #---------------- MAIN LOOP ----------------
  #-------------------------------------------
  while Button_Pressed == False:
  
  Button1_State = GPIO.input(Button1_Pin)
  Button2_State = GPIO.input(Button2_Pin)
  Button3_State = GPIO.input(Button3_Pin)
  Button4_State = GPIO.input(Button4_Pin)
  
  if Button1_State == False:
      Current_Genre = "Genre1"
      Button_Pressed = True
      Current_Genre_Directory = Genre1
  if Button2_State == False:
      Current_Genre = "Genre2"
      Button_Pressed = True
      Current_Genre_Directory = Genre2
  if Button3_State == False:
      Current_Genre = "Genre3"
      Button_Pressed = True
      Current_Genre_Directory = Genre3
  if Button4_State == False:
      Current_Genre = "Genre4"
      Button_Pressed = True
      Current_Genre_Directory = Genre4
  
  episode = random.choice(os.listdir(Current_Genre_Directory))
  Current_Movie_Path = Current_Genre_Directory + episode
  player = OMXPlayer(Current_Movie_Path)
  
  
  
  while ShutdownButton_state == True and QuitButton_state == True:
  
  Button_Pressed = False
  
  elapsed = player.position()
  Time_Remaining = (player.duration()  - elapsed)
  
  
  #Reads the state of the buttons
  Button1_State = GPIO.input(Button1_Pin)
  Button2_State = GPIO.input(Button2_Pin)
  Button3_State = GPIO.input(Button3_Pin)
  Button4_State = GPIO.input(Button4_Pin)
  ShutdownButton_state = GPIO.input(ShutdownButton_Pin)
  QuitButton_state = GPIO.input(QuitButton_pin)
  
  
  if Button1_State == False:
      Current_Genre = "Genre1"
      Button_Pressed = True
      Current_Genre_Directory = Genre1
  if Button2_State == False:
      Current_Genre = "Genre2"
      Button_Pressed = True
      Current_Genre_Directory = Genre2
  if Button3_State == False:
      Current_Genre = "Genre3"
      Button_Pressed = True
      Current_Genre_Directory = Genre3
  if Button4_State == False:
      Current_Genre = "Genre4"
      Button_Pressed = True
      Current_Genre_Directory = Genre4
  
  
  
  
  if Time_Remaining &lt; 1.0 :
      episode = random.choice(os.listdir(Current_Genre_Directory))
      Current_Movie_Path = Current_Genre_Directory + episode
      player.load(Current_Movie_Path, pause=False)
      sleep(Next_Movie_Wait_Time)
  
  
  
  if Button_Pressed == True:
      episode = random.choice(os.listdir(Current_Genre_Directory))
      Current_Movie_Path = Current_Genre_Directory + episode
      player.load(Current_Movie_Path, pause=False)
      sleep(Skip_Wait_Time)
  
  
  
  
  
  
  
  #what happens if quit or shutdown are pressed
  if QuitButton_state == False:
  player.quit()
  GPIO.cleanup()
  
  if ShutdownButton_state == False:
  call("sudo shutdown -h now", shell=True)
  </code></pre>
  
  <p>My problem is that when I run the program through the command prompt with:</p>
  
  <pre><code>sudo python3 /home/pi/RandomMoviePlayer_Rev1.py
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>"Traceback (most recent call last):
  File "/home/pi/RandomMoviePlayer_Rev1.py", line 7, in &lt;module&gt;
  from omxplayer.player import OMXPlayer
  ImportError: No module named 'omxplayer'"
  </code></pre>
  
  <p>I'm really not sure what to do to figure out whats going on. I tried installing OMXPLAYER with pip and pip3</p>
  
  <p>Any help would be greatly appreciated</p>