On 5/28/20, Roel Schroeven wrote:
> Eryk Sun schreef op 28/05/2020 om 15:51:
>> On 5/27/20, Chris Angelico wrote:
>>> On Thu, May 28, 2020 at 7:07 AM BlindAnagram
>>> wrote:
You can define a path however you want but it won't change the fact
that on Windows a path that ends in '\\' is
On 2020-05-28 22:34, Terry Reedy wrote:
On 5/28/2020 9:19 AM, Eryk Sun wrote:
On 5/26/20, BlindAnagram wrote:
But if I try to make the directory myself (as I tried first):
join(base, '..\\..\\', 'build', '\\')
I obtain:
'C:\\'
The documentation says that an absolute path in the paramet
BlindAnagram schreef op 28/05/2020 om 11:00:
On 27/05/2020 23:39, Roel Schroeven wrote:
I find no hints of adding a backslash at the end to indicate directories.
If you can point me to convincing evidence in the documentation I'll
change my mind.
And if you find a counterexample, I will change
Eryk Sun schreef op 28/05/2020 om 15:51:
On 5/27/20, Chris Angelico wrote:
On Thu, May 28, 2020 at 7:07 AM BlindAnagram
wrote:
You can define a path however you want but it won't change the fact that
on Windows a path that ends in '\\' is inherently a path to a directory.
Citation needed.
On 5/28/2020 9:19 AM, Eryk Sun wrote:
On 5/26/20, BlindAnagram wrote:
But if I try to make the directory myself (as I tried first):
join(base, '..\\..\\', 'build', '\\')
I obtain:
'C:\\'
The documentation says that an absolute path in the parameter list for
join will discard all previou
On 2020-05-27, Roel Schroeven wrote:
> I find no hints of adding a backslash at the end to indicate directories.
I suspect that, like Unix, that's not an OS/filesystem thing but
merely a convention used by some user space applications to allow the
user to provide an additional hint as to his int
On 27/05/2020 23:39, Roel Schroeven wrote:
> I find no hints of adding a backslash at the end to indicate directories.
>
> If you can point me to convincing evidence in the documentation I'll
> change my mind.
See the post from Eryk Sun, later in this thread.
--
https://mail.python.org/mailman/
On 5/28/20, BlindAnagram wrote:
>
> Thank you for making the effort to answer a number of issues raaised in
> this thread. I much appreciate your input.
For a more practical POV, see the topic on "File System Navigation"
[1] for the C++ standard API. In the C++ standard
library, trailing slashe
On 28/05/2020 14:51, Eryk Sun wrote:
> On 5/27/20, Chris Angelico wrote:
>> On Thu, May 28, 2020 at 7:07 AM BlindAnagram
>> wrote:
>>> You can define a path however you want but it won't change the fact that
>>> on Windows a path that ends in '\\' is inherently a path to a directory.
>>
>> Citati
On 5/27/20, Chris Angelico wrote:
> On Thu, May 28, 2020 at 7:07 AM BlindAnagram
> wrote:
>> You can define a path however you want but it won't change the fact that
>> on Windows a path that ends in '\\' is inherently a path to a directory.
>
> Citation needed.
See [MS-FSA] 2.1.5.1 Server Reque
On 5/26/20, BlindAnagram wrote:
>
> But if I try to make the directory myself (as I tried first):
>
> join(base, '..\\..\\', 'build', '\\')
>
> I obtain:
>
> 'C:\\'
>
> The documentation says that an absolute path in the parameter list for
> join will discard all previous parameters but '\\' is
On 27/05/2020 23:39, Roel Schroeven wrote:
> BlindAnagram schreef op 27/05/2020 om 22:55:
>> On 27/05/2020 18:42, Roel Schroeven wrote:
>>> BlindAnagram schreef op 27/05/2020 om 18:53:
Its not my bug to fix - the semantics of what I send is very clear on
any Windows system.
>>>
>>> That's
On Thu, May 28, 2020 at 7:07 AM BlindAnagram wrote:
> You can define a path however you want but it won't change the fact that
> on Windows a path that ends in '\\' is inherently a path to a directory.
Citation needed.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
BlindAnagram schreef op 27/05/2020 om 22:55:
On 27/05/2020 18:42, Roel Schroeven wrote:
BlindAnagram schreef op 27/05/2020 om 18:53:
Its not my bug to fix - the semantics of what I send is very clear on
any Windows system.
That's the first time I see any mention of those semantics, and I've
b
not (necessarily) offer solutions which are Windows-specific - by
definition.
Referring to the final conclusion:
a solution already exists (again, please refer to docs/link in previous
contribution, and repeated 'here' by @Beverley). She provides evidence
for macOS, here is same from L
On 27/05/2020 18:42, Roel Schroeven wrote:
> BlindAnagram schreef op 27/05/2020 om 18:53:
>> Its not my bug to fix - the semantics of what I send is very clear on
>> any Windows system.
>
> That's the first time I see any mention of those semantics, and I've
> been using Windows since the Windows
e') creates a directory.
> open('C:\\Documents\\finance', 'w') creates a file.
>
> The difference is in the operation, not in the name.
>
> 'C:\\Documents\\finance' is a pathname, which can refer to either a
> directory or a file.
> '
Roel Schroeven writes:
> Ben Bacarisse schreef op 27/05/2020 om 17:53:
>> There is well-known (*nix) software that relies on a/b/c/ meaning
>> something different to a/b/c but I don't know anyone who thinks this is
>> a good idea. It causes no end of confusion.
>
> rsync? I always have to look u
On Thu, May 28, 2020 at 6:14 AM Roel Schroeven wrote:
>
> Ben Bacarisse schreef op 27/05/2020 om 17:53:
> > There is well-known (*nix) software that relies on a/b/c/ meaning
> > something different to a/b/c but I don't know anyone who thinks this is
> > a good idea. It causes no end of confusion.
BlindAnagram writes:
> On 27/05/2020 16:53, Ben Bacarisse wrote:
>> As it should. Relying on a trailing \ having the right effect is
>> brittle to say the least.
>
> In my case less brittle than leaving it out.
Brittle does not mean broken. I know you can fix it by making sure the
trailing \
Ben Bacarisse schreef op 27/05/2020 om 17:53:
There is well-known (*nix) software that relies on a/b/c/ meaning
something different to a/b/c but I don't know anyone who thinks this is
a good idea. It causes no end of confusion.
rsync? I always have to look up whether or not I need to use a tra
BlindAnagram schreef op 27/05/2020 om 18:53:
Its not my bug to fix - the semantics of what I send is very clear on
any Windows system.
That's the first time I see any mention of those semantics, and I've
been using Windows since the Windows 3.1 days (and MS-DOS before that,
since 3.2 IIRC).
oks
more like a partial pathname, not a complete one.
I can't think of any reason for ending pathnames with (back)slashes.
Just use os.path.join(directory, filename) when you need to refer to a
file in the directory.
I would be surprised if issues such as these were not, at least in
signi
Dear all,
\On 26/05/2020 15:56, BlindAnagram wrote:
I came across an issue that I am wondering whether I should report as an
issue. If I have a directory, say:
base='C:\\Documents'
and I use os.path.join() as follows:
join(base, '..\\..\\', 'build',
ng an empty string as the
last part of the path. The following is on macOS (I don’t have a MS Windows
machine):
>>> import os.path
>>> os.path.join('/Users/myID/a', 'b','c')
'/Users/myID/a/b/c'
>>> os.path.join('/Users/myID/a&
On 27/05/2020 17:39, BlindAnagram wrote:
I believe by attempting to make the directory I send absolute with
abspath() and then copying a file to this path. They expected this to
copy the file into the directory with its original name but instead it
copies it to the file that abspath 'kindly' con
On 27/05/2020 16:53, Ben Bacarisse wrote:
> BlindAnagram writes:
>
>> On 27/05/2020 13:30, Ben Bacarisse wrote:
>>> BlindAnagram writes:
>>>
>>>> The issue that I raised here was whether the behaviour of os.path.join()
>>>> in treating th
On 27/05/2020 16:49, Rhodri James wrote:
> On 27/05/2020 16:12, BlindAnagram wrote:
>> I'm sorry that you don't believe me but all I know is how I intend the
>> path to be used. And the os.path functions aren't helpful here when
>> they actually_change_ the meanings of paths on Windows:
>>
f
BlindAnagram writes:
> On 27/05/2020 13:30, Ben Bacarisse wrote:
>> BlindAnagram writes:
>>
>>> The issue that I raised here was whether the behaviour of os.path.join()
>>> in treating the Windows directory separator '\\' as an absolute path
>>
On 27/05/2020 16:12, BlindAnagram wrote:
I'm sorry that you don't believe me but all I know is how I intend the
path to be used. And the os.path functions aren't helpful here when
they actually_change_ the meanings of paths on Windows:
fp= "C:\\Documents\finance\\"
abspath(fp)
'C:\\Documents
On 27/05/2020 14:53, Rhodri James wrote:
> On 27/05/2020 14:41, BlindAnagram wrote:
>> That is true if you know for sure how your path will be used.
>>
>> But if you don't, there is a world of difference between passing the
>> paths 'name' and 'name\\' on for others to use. And in this situation it
On 27/05/2020 14:41, BlindAnagram wrote:
That is true if you know for sure how your path will be used.
But if you don't, there is a world of difference between passing the
paths 'name' and 'name\\' on for others to use. And in this situation it
doesn't help when os.path functions strip the direc
On 27/05/2020 13:30, Ben Bacarisse wrote:
> BlindAnagram writes:
>
>> The issue that I raised here was whether the behaviour of os.path.join()
>> in treating the Windows directory separator '\\' as an absolute path
>> should be considered a bug.
>
> Y
BlindAnagram writes:
> The issue that I raised here was whether the behaviour of os.path.join()
> in treating the Windows directory separator '\\' as an absolute path
> should be considered a bug.
You think it should be considered to be a relative path? The only
meaning
.PureWindowsPath('/').is_absolute()
>>> |False
>>
>> Thanks, that seems to suggest that there is an issue and that I should
>> hence submit this as an issue.
>
> Can you post the a link to the issue please?
The issue that I raised here was whether the beha
On Wed, May 27, 2020 at 6:50 PM Barry Scott wrote:
>
>
>
> > On 26 May 2020, at 18:01, BlindAnagram wrote:
> >
> > On 26/05/2020 17:09, Stefan Ram wrote:
> >> Mats Wichmann writes:
> >>> an absolute path is one that starts with the pathname separator.
> >>
> >> The Python Library Reference does
> On 26 May 2020, at 18:01, BlindAnagram wrote:
>
> On 26/05/2020 17:09, Stefan Ram wrote:
>> Mats Wichmann writes:
>>> an absolute path is one that starts with the pathname separator.
>>
>> The Python Library Reference does not use the term
>> "pathname separator". It uses "directory sepa
e. If I have a directory, say:
>>>>
>>>> base='C:\\Documents'
>>>>
>>>> and I use os.path.join() as follows:
>>>>
>>>> join(base, '..\\..\\', 'build', '')
>>> It rathe
On 2020-05-26, Dennis Lee Bieber wrote:
> I'd also like to point out that the nasty "\\" is not needed. Windows
> API understands "/" -- it is only the command line "DOS" shell that
> requires back-slash
Many, many applications also require that backslashes be used in path
arguments (wheth
On 27/05/20 5:23 AM, BlindAnagram wrote:
On 26/05/2020 16:59, Mats Wichmann wrote:
On 5/26/20 8:56 AM, BlindAnagram wrote:
I came across an issue that I am wondering whether I should report as an
issue. If I have a directory, say:
base='C:\\Documents'
and I use os.path.join()
On 2020-05-26 16:52, Dennis Lee Bieber wrote:
On Tue, 26 May 2020 16:22:27 +0100, Ben Bacarisse
declaimed the following:
I think it is. The picture is messy on Windows (because of the drive
letter) but absolute paths are usually taken to be those that start with
a path separator.
Th
gt;> issue. If I have a directory, say:
>>>>
>>>> base='C:\\Documents'
>>>>
>>>> and I use os.path.join() as follows:
>>>>
>>>> join(base, '..\\..\\', 'build', '')
>>>&
> base='C:\\Documents'
>>>
>>> and I use os.path.join() as follows:
>>>
>>> join(base, '..\\..\\', 'build', '')
>>>
>>> I obtain as expected from the documentation:
>>>
>>> 'C:\\
On 26/05/2020 16:59, Mats Wichmann wrote:
> On 5/26/20 8:56 AM, BlindAnagram wrote:
>> I came across an issue that I am wondering whether I should report as an
>> issue. If I have a directory, say:
>>
>> base='C:\\Documents'
>>
>> and I
:
base='C:\\Documents'
and I use os.path.join() as follows:
join(base, '..\\..\\', 'build', '')
It rather defeats the purpose of os.sep if you include it in a part of
the path. What you mean is better expressed as
join(base, '..', '..
On 26/05/2020 18:01, BlindAnagram wrote:
On 26/05/2020 17:09, Stefan Ram wrote:
Mats Wichmann writes:
an absolute path is one that starts with the pathname separator.
The Python Library Reference does not use the term
"pathname separator". It uses "directory separator"
(os.sep) and
gt;> issue. If I have a directory, say:
>>>>
>>>> base='C:\\Documents'
>>>>
>>>> and I use os.path.join() as follows:
>>>>
>>>> join(base, '..\\..\\', 'build', '')
>>>
>&g
On 26/05/2020 17:09, Stefan Ram wrote:
> Mats Wichmann writes:
>> an absolute path is one that starts with the pathname separator.
>
> The Python Library Reference does not use the term
> "pathname separator". It uses "directory separator"
> (os.sep) and "filename separator" ('/' on Unix).
On 26/05/2020 16:59, Mats Wichmann wrote:
> On 5/26/20 8:56 AM, BlindAnagram wrote:
>> I came across an issue that I am wondering whether I should report as an
>> issue. If I have a directory, say:
>>
>> base='C:\\Documents'
>>
>> and I
On 2020-05-26 16:48, BlindAnagram wrote:
On 26/05/2020 16:22, Ben Bacarisse wrote:
BlindAnagram writes:
I came across an issue that I am wondering whether I should report as an
issue. If I have a directory, say:
base='C:\\Documents'
and I use os.path.join() as follows:
On 5/26/20 8:56 AM, BlindAnagram wrote:
> I came across an issue that I am wondering whether I should report as an
> issue. If I have a directory, say:
>
> base='C:\\Documents'
>
> and I use os.path.join() as follows:
>
> join(base, '..\\..\\',
On 26/05/2020 16:25, Stefan Ram wrote:
> BlindAnagram writes:
>> The documentation says that an absolute path in the parameter list for
>> join will discard all previous parameters but '\\' is not an absoute path!
>
> The source code for "join" in "ntpath.py" does not seem to
> bother to call
On 26/05/2020 16:22, Ben Bacarisse wrote:
> BlindAnagram writes:
>
>> I came across an issue that I am wondering whether I should report as an
>> issue. If I have a directory, say:
>>
>> base='C:\\Documents'
>>
>> and I use os.path.join
BlindAnagram writes:
> I came across an issue that I am wondering whether I should report as an
> issue. If I have a directory, say:
>
> base='C:\\Documents'
>
> and I use os.path.join() as follows:
>
> join(base, '..\\..\\', 'build'
I came across an issue that I am wondering whether I should report as an
issue. If I have a directory, say:
base='C:\\Documents'
and I use os.path.join() as follows:
join(base, '..\\..\\', 'build', '')
I obtain as expected from the documentation:
e filename() and filelineno() function calls with
>> the fileinput module.
>
> By 'qualify', do you mean something like
> l.append(fileinput.filename())?
>
>>
>> > FileNotFoundError: [Errno 2] No such file or directory: 'THE LAND OF LOST
TOYS~&
On Mon, Jun 15, 2015 at 8:00 PM, Malik Rumi wrote:
> I have struggled with this for several hours and not made much progress. I
> was not sure if your 'names' variable was supposed to be the same as
> 'filenames'. Also, it should be 'os.path.join', not os.
l.append(filename(), filelineno(), line)
> >>
> >> Although it's not the problem at hand, I think you'll find that you
> >> need to qualify the filename() and filelineno() function calls with
> >> the fileinput module.
> >
> >
04.11.13 20:01, Mark Lawrence написав(ла):
On 04/11/2013 17:34, Ethan Furman wrote:
On 11/04/2013 09:29 AM, random...@fastmail.us wrote:
I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').
Ope
On 04/11/2013 17:34, Ethan Furman wrote:
On 11/04/2013 09:29 AM, random...@fastmail.us wrote:
I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').
Open a bug report. :)
http://bugs.python.org
On 11/04/2013 09:29 AM, random...@fastmail.us wrote:
I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').
Open a bug report. :)
http://bugs.python.org
--
~Ethan~
--
https://mail.python.org/mai
On Monday, November 4, 2013 9:47:18 PM UTC+5:30, Chris Angelico wrote:
> Blargh, wrong list. It should have been private anyway. Kindly take no
> notice of the man behind the 3AM clock...
>
>
> ChrisA
Ive got a little list Ive got a little list
For Australians of all kinds Ive got a little list
On Mon, Nov 4, 2013, at 11:07, Chris Angelico wrote:
> Then os.path.join is probably the wrong tool for the job. Do you want
> to collapse "/foo/bar" + "../quux" into "/foo/quux"? That rewrites the
> first. If not, don't use a function that does tha
first.
Then os.path.join is probably the wrong tool for the job. Do you want
to collapse "/foo/bar" + "../quux" into "/foo/quux"? That rewrites the
first. If not, don't use a function that does that. Try simple string
concatenation instead.
Wrong mailing list. ;
adays. In there if I
>> want to join two paths, no matter if 2nd starts with slash or not, I
>> don't really expect the 2nd to rewrite the first.
>
> Then os.path.join is probably the wrong tool for the job. Do you want
> to collapse "/foo/bar" + "../quux&qu
On Tue, Nov 5, 2013 at 2:29 AM, anatoly techtonik wrote:
> Right. But I am working more with URL paths nowadays. In there if I
> want to join two paths, no matter if 2nd starts with slash or not, I
> don't really expect the 2nd to rewrite the first.
Then os.path.join is probably
On Wed, Jan 30, 2013 at 12:56 PM, iMath wrote:
> 在 2013年1月29日星期二UTC+8下午9时33分26秒,Steven D'Aprano写道:
>> iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns
>> [] ? Because you are iterating over an empty list, []. That list
>> com
在 2013年1月29日星期二UTC+8下午9时33分26秒,Steven D'Aprano写道:
> iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns
> [] ? Because you are iterating over an empty list, []. That list
> comprehension is the equivalent of: result = [] for name in []:
> r
On 01/29/2013 08:21 AM, iMath wrote:
why [os.path.join(r'E:\Python', name) for name in []] returns [] ?
please explain it in detail !
[ os.path.join(r'E:\Python', name) for name in [] ]
It'd be nice if you would explain what part of it bothers you. Do you
know wha
iMath wrote:
> why [os.path.join(r'E:\Python', name) for name in []] returns [] ?
Because you are iterating over an empty list, [].
That list comprehension is the equivalent of:
result = []
for name in []:
result.append( os.path.join(r'E:\Python', name) )
Since yo
- Original Message -
> why [os.path.join(r'E:\Python', name) for name in []] returns [] ?
> please explain it in detail !
> --
> http://mail.python.org/mailman/listinfo/python-list
>
You're mapping an empty list.
"for name in []"
JM
-- IMPORT
On Wed, Jan 30, 2013 at 12:21 AM, iMath wrote:
> why [os.path.join(r'E:\Python', name) for name in []] returns [] ?
> please explain it in detail !
That's a list comprehension. If you're familiar with functional
programming, it's like a map operation. Since the
why [os.path.join(r'E:\Python', name) for name in []] returns [] ?
please explain it in detail !
--
http://mail.python.org/mailman/listinfo/python-list
Kushal Das writes:
> There is a comment on posixpath.join saying "Ignore the previous parts
> if a part is absolute."
It means: "join(something, abspath) == abspath" whenever "abspath"
is an absolute path.
> Is this defined in the POSIX spec ? If yes, then can someone please
> point me to a li
Hi all,
There is a comment on posixpath.join saying "Ignore the previous parts
if a part is absolute."
Is this defined in the POSIX spec ? If yes, then can someone please
point me to a link where I can read about it ?
Kushal
--
http://fedoraproject.org
http://kushaldas.in
--
http://mail.python
hes.
> > >
> > >
> > > --
> > > Steven
> >
> > Paths that mix /s and \s are NOT valid on Windows. In one of the
> > setup.py scripts I wrote I had to write a function to collect the
> > paths of data files for installation. On Windows it didn&
slashes.
--
Steven
Paths that mix /s and \s are NOT valid on
Windows. In one of the setup.py scripts I wrote
I had to write a function to collect the paths
of data files for installation. On Windows it
didn't work and it was driving me crazy. It
wasn't until I realized os.path.join
path.replace('/', '\\')
>
> before displaying them to the user. Likewise if you have to pass the
> paths to some application that doesn't understand slashes.
>
>
> --
> Steven
Paths that mix /s and \s are NOT valid on Windows. In one of the
setup
On Thu, 03 Feb 2011 07:58:55 -0800, Ethan Furman wrote:
> Steven D'Aprano wrote:
>> BTW, Windows accepts / as well as \ as a path separator. You will have
>> far fewer headaches if you use that.
>
> Just because Windows accepts / doesn't make it a good idea...
No. Windows accepting slashes as th
Steven D'Aprano wrote:
BTW, Windows accepts / as well as \ as a path separator. You will have
far fewer headaches if you use that.
Just because Windows accepts / doesn't make it a good idea...
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "help",
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' is a valid
path. .. means parent, not 'go back a directory'. But you should really
be trying this:
p1 = os.environ['HOMEPATH']
p2 = os.path.join(p1, 'Pictures', 'images', 'my.jpg
rectories should be taken from command-line parameters,
registry entries, configuration files, environment variables etc, not
embedded into the program. Paths relative to those directories should be
constructed with os.path.join().
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 02 Feb 2011 20:46:12 -0800, harryos wrote:
> In windows ,I tried this
>
> p1 = "C:\Users\me\Documents"
> p2 = "..\Pictures\images\my.jpg"
>
> print os.path.join(p1,p2)
> This gives
> 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.
On Wed, Feb 2, 2011 at 8:46 PM, harryos wrote:
> In windows ,I tried this
>
> p1 = "C:\Users\me\Documents"
> p2 = "..\Pictures\images\my.jpg"
>
> print os.path.join(p1,p2)
> This gives
> 'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg'
In windows ,I tried this
p1 = "C:\Users\me\Documents"
p2 = "..\Pictures\images\my.jpg"
print os.path.join(p1,p2)
This gives
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg'
I expected I would get
'C:\\Users\\me\\Pictures\\images\\my.jpg'
I though
ath='z:\\orders'):
destination = os.path.join([restore_path, job_num])
print os.path.join([save_path, job_num])
As the astute reader will doubt notice, job_num should be a string. As
I was not an astute typer during development, I just put in an integer:
-->uncompress_job(18273)
[
s'):
destination = os.path.join([restore_path, job_num])
print os.path.join([save_path, job_num])
As the astute reader will doubt notice, job_num should be a string. As
I was not an astute typer during development, I just put in an integer:
-->uncompress_job(18273)
['z:\\oldjobs'
On May 16, 3:40 pm, gert wrote:
> On May 16, 3:16 pm, "Diez B. Roggisch" wrote:
>
> > gert schrieb:
>
> > > open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
> > > 'rb')
> > > how do you do this on
On May 16, 3:16 pm, "Diez B. Roggisch" wrote:
> gert schrieb:
>
> > open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
> > 'rb')
> > how do you do this on windows (py3) so it still works on linux ?
>
> os.path.join(&q
Diez B. Roggisch wrote:
gert schrieb:
open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
'rb')
how do you do this on windows (py3) so it still works on linux ?
os.path.join("..", "www", "bin", "picture.png"
gert schrieb:
open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
'rb')
how do you do this on windows (py3) so it still works on linux ?
os.path.join("..", "www", "bin", "picture.png")
Or use os.sep.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
'rb')
how do you do this on windows (py3) so it still works on linux ?
--
http://mail.python.org/mailman/listinfo/python-list
Paul Scott wrote:
... example:
if os.path.exists(os.path.join(basedir,picdir)) == True :
blah blah
Question is, is there a better way of doing this? The above *works* but
it looks kinda hackish...
You've had the joining addressed elsewhere, but note that:
if os.path.e
On 2008-05-05, Paul Scott <[EMAIL PROTECTED]> wrote:
> Today, I needed to concatenate a bunch of directory paths and files
> together based on user input to create file paths. I achieved this
> through nested os.path.join()'s which I am unsure if this is a good
> thing or n
On Mon, 2008-05-05 at 10:34 -0400, Jean-Paul Calderone wrote:
> How about not nesting the calls?
>
> >>> from os.path import join
> >>> join(join('x', 'y'), 'z') == join('x', 'y', 'z')
> True
> >>>
>
Great! Thanks. Didn't realise that you could do that... :)
--Paul
All Email o
On Mon, 05 May 2008 16:28:33 +0200, Paul Scott <[EMAIL PROTECTED]> wrote:
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote:
example:
if os.path.exists(os.path.join(basedir,picdir)) == True :
blah blah
Sorry, pasted the wrong example...
Better example:
pics = glo
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote:
> example:
>
> if os.path.exists(os.path.join(basedir,picdir)) == True :
> blah blah
>
Sorry, pasted the wrong example...
Better example:
pics = glob.glob(os.path.join(os.path.join(basedir,picdir),'*'))
Today, I needed to concatenate a bunch of directory paths and files
together based on user input to create file paths. I achieved this
through nested os.path.join()'s which I am unsure if this is a good
thing or not.
example:
if os.path.exists(os.path.join(basedir,picdir)) == True :
Elliot Peele <[EMAIL PROTECTED]> wrote:
>On Tue, 2007-05-01 at 19:27 -0700, 7stud wrote:
>> On May 1, 7:36 pm, Elliot Peele <[EMAIL PROTECTED]> wrote:
>> > Why does os.path.join('/foo', '/bar') return '/bar' rather than
>> > &
On May 2, 12:36 am, Ant <[EMAIL PROTECTED]> wrote:
> On May 2, 8:03 am, [EMAIL PROTECTED] wrote:
>
> > On May 1, 11:10 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
> ...
> > > I think it's a bug, but because it should raise TypeError instea
1 - 100 of 118 matches
Mail list logo