[Biopython-dev] [biopython] Missing DTD files (#260)

Peter Cock p.j.a.cock at googlemail.com
Mon Dec 9 15:52:22 UTC 2013

> On 9 December 2013 14:20, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
>> Can somebody with a Windows computer check what os.path.expanduser('~')
>> refers to on Windows? Or how matplotlib solves this on Windows (they are
>> storing files under $HOME/.matplotlib on unix-like systems; I don't know
>> what they use on Windows).
>> Thanks,
>> -Michiel.

On Windows XP, using Python 2.6, 2.7, 3.3, or PyPy 2.2,

C:\Documents and Settings\pc40583>c:\python26\python
Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print(os.path.expanduser('~'))
C:\Documents and Settings\pcock

i.e. As expected, it found my home directory.

On Mon, Dec 9, 2013 at 2:40 PM, Tiago Antão <tiagoantao at gmail.com> wrote:
> Hi,
> I do not have access here to a windows machine (later in the day I can).
> But:
>  /.biopython/Bio/Entrez/DTDs
> should not be correct. You probably want to replace "/" with os.sep, say:
> os.sep.join([".biopython", "Bio", "Entrez", "DTDs"])
> which will give you
> \.biopython\Bio\Entrez\DTDs

Yes in theory, but in practice using the Unix style slashes works
just fine in my experience (and they are used in many of our
unit tests without problem). Even a mix of slashes works.

Note style-wise it would be preferable to use os.path.join(...)
rather than the string join method os.sep.join(...) as shown.


More information about the Biopython-dev mailing list