Is there a way of determining the suffix used after a drive letter to denote a drive, e.g. on Windows the ":" in r"C:\Dir\Subdir\File.Ext" ? Or is the colon so universal that it is considered unnecessary? Should it be in the os module somewhere (as far as I can tell, it isn't, although every other kind of file path component separator seems to be) ? Best wishes Rob Cliffe
On Wed, Aug 04, 2010 at 03:45:45PM +0100, Rob Cliffe wrote:
Is there a way of determining the suffix used after a drive letter to denote a drive, e.g. on Windows the ":" in r"C:\Dir\Subdir\File.Ext" ? Or is the colon so universal that it is considered unnecessary? Should it be in the os module somewhere (as far as I can tell, it isn't, although every other kind of file path component separator seems to be) ?
It's not universal, exactly opposite - it's specific to a rare graphic environment produced by a small company based in Redmond... sorry, I cannot resist. (-: Because of this (':' being too specific) it's built right into ntpath.py - the module that 'os' module imports when it finds itself running inside that graphic environment. It's used as a character constant all over ntpath.py without any name. Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
It's Windows specific syntax and always a colon. Use os.path.splitdrive() to parse it. I don't think there's a need to add a named constant for it (you're the first to ask, in my memory). On Wed, Aug 4, 2010 at 7:45 AM, Rob Cliffe <rob.cliffe@btinternet.com> wrote:
Is there a way of determining the suffix used after a drive letter to denote a drive, e.g. on Windows the ":" in r"C:\Dir\Subdir\File.Ext" ? Or is the colon so universal that it is considered unnecessary? Should it be in the os module somewhere (as far as I can tell, it isn't, although every other kind of file path component separator seems to be) ?
-- --Guido van Rossum (python.org/~guido)
On Thu, Aug 5, 2010 at 1:10 AM, Guido van Rossum <guido@python.org> wrote:
It's Windows specific syntax and always a colon. Use os.path.splitdrive() to parse it. I don't think there's a need to add a named constant for it (you're the first to ask, in my memory).
HI Guido, I'm not a windows user or developer, but I concur. When I was reading this post I kept thinking to myself that Windows is one of the only Operating Systems with a File system that reuiqres this [A-Z]:\ syntax. All sensible POSIX systems I know and File Systems all mount various other media on "mount points". *shrug* --James -- -- James Mills -- -- "Problems are solved by method"
James Mills wrote:
Windows is one of the only Operating Systems with a File system that reuiqres this [A-Z]:\ syntax.
There's also VMS, but it uses a colon too. Also its pathnames are funky enough in other ways that it needs its own os-specific pathname routines. I'm not aware of any system that's "just like Windows" except that it uses something other than colons. -- Greg
"Stephen J. Turnbull" <stephen@xemacs.org> writes:
It's a shame that Windows machines can be networked
+1 QOTW Even if QOTW doesn't work in this forum, I still cast my vote. -- \ “We should strive to do things in [Gandhi's] spirit… not to use | `\ violence in fighting for our cause, but by non-participation in | _o__) what we believe is evil.” —Albert Einstein | Ben Finney
2010/8/5 Greg Ewing <greg.ewing@canterbury.ac.nz>
James Mills wrote:
Windows is one of the only Operating Systems with a File system that reuiqres this [A-Z]:\ syntax.
There's also VMS, but it uses a colon too. Also its pathnames are funky enough in other ways that it needs its own os-specific pathname routines.
I'm not aware of any system that's "just like Windows" except that it uses something other than colons.
-- Greg
AmigaOS / AROS / MorphOS uses colon too as a volume (or device) separator: dir "Ram Disk:System/Local Preferences" Cesare
Thanks for your replies, guys. As it happens, what sparked the question was trying to determine in a platform-independent way whether a path consisted of a bare drive specification (e.g. "C:"). I guess os.path.splitdrive(MyPath)[1] == "" takes care of that. Rob Cliffe ----- Original Message ----- From: "Guido van Rossum" <guido@python.org> To: "Rob Cliffe" <rob.cliffe@btinternet.com> Cc: "Python-Dev" <python-dev@python.org> Sent: Wednesday, August 04, 2010 4:10 PM Subject: Re: [Python-Dev] Drive suffix It's Windows specific syntax and always a colon. Use os.path.splitdrive() to parse it. I don't think there's a need to add a named constant for it (you're the first to ask, in my memory). On Wed, Aug 4, 2010 at 7:45 AM, Rob Cliffe <rob.cliffe@btinternet.com> wrote:
Is there a way of determining the suffix used after a drive letter to denote a drive, e.g. on Windows the ":" in r"C:\Dir\Subdir\File.Ext" ? Or is the colon so universal that it is considered unnecessary? Should it be in the os module somewhere (as far as I can tell, it isn't, although every other kind of file path component separator seems to be) ?
-- --Guido van Rossum (python.org/~guido)
On Wednesday 04 August 2010, Rob Cliffe wrote:
As it happens, what sparked the question was trying to determine in a platform-independent way whether a path consisted of a bare drive specification (e.g. "C:"). I guess os.path.splitdrive(MyPath)[1] == "" takes care of that.
"platform-independent"? What is a "bare drive specification" on a FreeBSD system? Do you perhaps mean "mount point" instead? I don't think this discussion belongs Here(tm) though. BTW: Embedded MS Windows CE uses a filesystem tree like *nix, i.e. without drive letters. Not that I have any kind of Python crawling on one of those yet, just wanted to mention... Uli -- Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 ************************************************************************************** Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 ************************************************************************************** Visit our website at <http://www.satorlaser.de/> ************************************************************************************** Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden. E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich. **************************************************************************************
participants (9)
-
Ben Finney -
Cesare Di Mauro -
Greg Ewing -
Guido van Rossum -
James Mills -
Oleg Broytman -
Rob Cliffe -
Stephen J. Turnbull -
Ulrich Eckhardt