RasPi 3 Python: why does Popen break out my while loop?Debian/LXDE terminal, how to disable it/disable the panel barWhat does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?Why does “not(True) in [False, True]” return False?Python3.4 - How do I get the PID of a program that was started with Popen? (OS -Raspbian Jessie)TkInter Frame doesn't load if another function is calledBreak out of if while loop in pythonRasPi Python - ModuleNotFoundError: No module named 'tornado'Omxplayer-wrapper problems when run from terminalHow to play a shuffled list of videos in omxplayer

Why would image resources loaded from different origins triggering HTTP authentication dialogs be harmful?

Was the lunar landing site always in the same plane as the CM's orbit?

Is there a neutral term for people who tend to avoid face-to-face or video/audio communication?

Dissuading my girlfriend from a scam

Male viewpoint in an erotic novel

Fantasy Military Arms and Armor: the Dwarven Grand Armory

I won a car in a poker game. How is that taxed in Canada?

Are there mathematical concepts that exist in the fourth dimension, but not in the third dimension?

What are some countries where you can be imprisoned for reading or owning a Bible?

Do 643,000 Americans go bankrupt every year due to medical bills?

Existence of a Hölder-free space

Remaining in the US beyond VWP admission period

How do I make my fill-in-the-blank exercise more obvious?

Why does the seven segment display have decimal point at the right?

extract specific cheracters from each line

Why did Boris Johnson call for new elections?

Can you create water inside someone's mouth?

How do I use NEC PC-6001 .p6 or .cas files?

Is there some sort of French saying for "a person's signature move"?

Book where main character comes out of stasis bubble

Why did Tony's Arc Reactor do this?

Pronounceable encrypted text

What are the map units that WGS84 uses?

How do I anonymously report the Establishment Clause being broken?



RasPi 3 Python: why does Popen break out my while loop?


Debian/LXDE terminal, how to disable it/disable the panel barWhat does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?Why does “not(True) in [False, True]” return False?Python3.4 - How do I get the PID of a program that was started with Popen? (OS -Raspbian Jessie)TkInter Frame doesn't load if another function is calledBreak out of if while loop in pythonRasPi Python - ModuleNotFoundError: No module named 'tornado'Omxplayer-wrapper problems when run from terminalHow to play a shuffled list of videos in omxplayer






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I wanted to play two videos with each command and try to stop them also, but as i run the code, it plays but the while loop ends or the whole program is killed.



This is the code:



import os
import sys
from time import sleep
from subprocess import Popen

movie1 = ("/home/pi/Downloads/movie1.mp4")
movie2 = ("/home/pi/Downloads/movie2.mp4")

def vPlay(video):

os.system('killall omxplayer.bin')
omxc = Popen(['omxplayer', '-b', video])
sleep(1)


if __name__ == "__main__":

while True:
print("Command:")
x = input()

if x == 'q':

vPlay(movie1)
omxc = Popen(['omxplayer','i'])

elif x == 'w':

vPlay(movie2)
omxc = Popen(['omxplayer','i'])

elif x == 'e':
os.system('killall omxplayer.bin')



This is the Terminal:



>>> %Run sys.py
Command:
q
omxplayer.bin: no process found
Command:

========================= RESTART =========================
>>>


Please help me find some solution for this problem. Thank You










share|improve this question






























    0















    I wanted to play two videos with each command and try to stop them also, but as i run the code, it plays but the while loop ends or the whole program is killed.



    This is the code:



    import os
    import sys
    from time import sleep
    from subprocess import Popen

    movie1 = ("/home/pi/Downloads/movie1.mp4")
    movie2 = ("/home/pi/Downloads/movie2.mp4")

    def vPlay(video):

    os.system('killall omxplayer.bin')
    omxc = Popen(['omxplayer', '-b', video])
    sleep(1)


    if __name__ == "__main__":

    while True:
    print("Command:")
    x = input()

    if x == 'q':

    vPlay(movie1)
    omxc = Popen(['omxplayer','i'])

    elif x == 'w':

    vPlay(movie2)
    omxc = Popen(['omxplayer','i'])

    elif x == 'e':
    os.system('killall omxplayer.bin')



    This is the Terminal:



    >>> %Run sys.py
    Command:
    q
    omxplayer.bin: no process found
    Command:

    ========================= RESTART =========================
    >>>


    Please help me find some solution for this problem. Thank You










    share|improve this question


























      0












      0








      0








      I wanted to play two videos with each command and try to stop them also, but as i run the code, it plays but the while loop ends or the whole program is killed.



      This is the code:



      import os
      import sys
      from time import sleep
      from subprocess import Popen

      movie1 = ("/home/pi/Downloads/movie1.mp4")
      movie2 = ("/home/pi/Downloads/movie2.mp4")

      def vPlay(video):

      os.system('killall omxplayer.bin')
      omxc = Popen(['omxplayer', '-b', video])
      sleep(1)


      if __name__ == "__main__":

      while True:
      print("Command:")
      x = input()

      if x == 'q':

      vPlay(movie1)
      omxc = Popen(['omxplayer','i'])

      elif x == 'w':

      vPlay(movie2)
      omxc = Popen(['omxplayer','i'])

      elif x == 'e':
      os.system('killall omxplayer.bin')



      This is the Terminal:



      >>> %Run sys.py
      Command:
      q
      omxplayer.bin: no process found
      Command:

      ========================= RESTART =========================
      >>>


      Please help me find some solution for this problem. Thank You










      share|improve this question














      I wanted to play two videos with each command and try to stop them also, but as i run the code, it plays but the while loop ends or the whole program is killed.



      This is the code:



      import os
      import sys
      from time import sleep
      from subprocess import Popen

      movie1 = ("/home/pi/Downloads/movie1.mp4")
      movie2 = ("/home/pi/Downloads/movie2.mp4")

      def vPlay(video):

      os.system('killall omxplayer.bin')
      omxc = Popen(['omxplayer', '-b', video])
      sleep(1)


      if __name__ == "__main__":

      while True:
      print("Command:")
      x = input()

      if x == 'q':

      vPlay(movie1)
      omxc = Popen(['omxplayer','i'])

      elif x == 'w':

      vPlay(movie2)
      omxc = Popen(['omxplayer','i'])

      elif x == 'e':
      os.system('killall omxplayer.bin')



      This is the Terminal:



      >>> %Run sys.py
      Command:
      q
      omxplayer.bin: no process found
      Command:

      ========================= RESTART =========================
      >>>


      Please help me find some solution for this problem. Thank You







      python-3.x raspberry-pi3 raspbian






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 4:33









      cazmocazmo

      11 bronze badge




      11 bronze badge

























          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390221%2fraspi-3-python-why-does-popen-break-out-my-while-loop%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390221%2fraspi-3-python-why-does-popen-break-out-my-while-loop%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript