Gå til innhold

Anbefalte innlegg

Videoannonse
Annonse

det avhenger av platform tydeligvis. spurte litt rundt. på *nix kan du kjøre systemkall til "eject"

 

00:13 < torbjorn> is it possible to print out without appending a space?
00:14 < dannym> torbjorn: sys.stdout.write(...)
00:14 < torbjorn> i see, thanks
00:14 < torbjorn> hm, why is this so
00:16 < dannym> torbjorn: because print is trying to be smart about spacings...
00:16 < Yhg1s> because it is. print is a conveniency statement. If you want to
              do exact writing to files, including stdout, use file methods.
00:17 < torbjorn> i see..
00:17 < torbjorn> while im at it - is it possible to open the cd tray from
                 python?
00:18 < Yhg1s> which one?
00:18 < Yhg1s> on which platform? :)
00:19 < torbjorn> whichever, on either :)
00:19 < dannym> torbjorn: probably ... but I think the cdrom module still
               misses the code, so you'd have to syscall manually :)
00:19 < Yhg1s> it is, but it's terribly inconvenient.
00:19 < Yhg1s> just execute 'eject' on unix systems.
00:19 < torbjorn> right right.. everything is possible :)
00:19 < Yhg1s> on windows, I bet there's an obscure win32api call you can use.
00:19 < dannym> this calls for a patch to the python cdrom module after it is
               working :)
00:20 < torbjorn> ImportError: No module named cdrom
00:20 < torbjorn> work in progress.. i see.
00:20 < torbjorn> thanks guys, and good night.

 

EDIT: litt mer

 

00:20 < dannym> good night torbjorn
00:22 < dannym> btw, for linux it's ioctl(fd, CDROMEJECT) :)
00:22 < dannym> there is also CDROMCLOSETRAY
00:23 < dannym> on windows it's
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp
00:24 < dannym> on windows, easier :
http://mail.python.org/pipermail/python-win32/2002-November/000593.html
00:24 < torbjorn> thats... lots of code
00:24 < torbjorn> thats less
00:24 < dannym> (_and_ already in python :))

Endret av Torbjørn

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...