This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin, python and abspath()


On Tue, Jul 16, 2013 at 06:01:06PM +0300, Mikko Rapeli wrote:
> Hi,
> 
> Does anyone know why os.path.abspath() in python on cygwin is creating
> invalid path names when given these cygwin compatible dos path names?
> 
> $ pwd
> /cygdrive/c/temp
> 
> $ python -c "import os; os.path.abspath('/cygdrive/c/temp')"
> /cygdrive/c/temp
> 
> $ python -c "import os; os.path.abspath('c:/temp')"
> /cygdrive/c/temp/c:/temp
> 
> I have cmake generating the dos compatible path names and they work with
> all other cygwin utilities that I've used.

Perl seems to understand both ways as absolute paths:

$ perl -e 'use File::Spec; print File::Spec->rel2abs("c:/temp")'
c:/temp

$ perl -e 'use File::Spec; print File::Spec->rel2abs("/cygdrive/c/temp")'
/cygdrive/bin/perl

$ which perl
/usr/bin/perl

$ perl --version | head -2 | tail -1
This is perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-thread-multi-64int

-Mikko

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]