Skip to content

Instantly share code, notes, and snippets.

@shubham1810
Created November 4, 2014 15:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shubham1810/93c6e379276020175060 to your computer and use it in GitHub Desktop.
Save shubham1810/93c6e379276020175060 to your computer and use it in GitHub Desktop.
python script to continously open the cd-drive of any PC
'''__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)
@Boost14
Copy link

Boost14 commented Jan 24, 2021

how to run this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment