Created
November 4, 2014 15:12
-
-
Save shubham1810/93c6e379276020175060 to your computer and use it in GitHub Desktop.
python script to continously open the cd-drive of any PC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''__author__ = "Shubham Dokania" | |
# This script will keep on opening the cd player | |
# of a linux pc in every 5 seconds in an infinite loop | |
import os, time | |
time.sleep(5) | |
while 1: | |
try: | |
os.system("eject cdrom") | |
time.sleep(5) | |
except: | |
print "error" | |
''' | |
# Using pygame module will make the code universal, i.e. This code will now run on any Operating system | |
import time, pygame.cdrom as cdrom | |
#time.sleep(5) | |
while 1: | |
cdrom.init() | |
cd = cdrom.CD(0) | |
cd.init() | |
cd.eject() | |
cd.quit() | |
cdrom.quit() | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to run this?