Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83155 > unrolled thread

Re: pathlib type error

Started byChris Angelico <rosuav@gmail.com>
First post2015-01-03 23:06 +1100
Last post2015-01-03 23:06 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: pathlib type error Chris Angelico <rosuav@gmail.com> - 2015-01-03 23:06 +1100

#83155 — Re: pathlib type error

FromChris Angelico <rosuav@gmail.com>
Date2015-01-03 23:06 +1100
SubjectRe: pathlib type error
Message-ID<mailman.17348.1420286783.18130.python-list@python.org>
On Sat, Jan 3, 2015 at 10:55 PM, Georg Grafendorfer
<georg.grafendorfer@gmail.com> wrote:
> I'm using Debian 8 Jessie on an AMD64 machine.
> Getting this error:
>
> ~$ python3
> Python 3.4.2 (default, Oct  8 2014, 10:45:20)
> [GCC 4.9.1] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from pathlib import Path
>>>> p = Path("/etc")
>>>> q = p / "init.d"
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unsupported operand type(s) for /: 'PosixPath' and 'str'
>>>>

Unable to reproduce:

rosuav@dewey:~$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> p = Path("/etc")
>>> q = p / "init.d"
>>> q
PosixPath('/etc/init.d')
>>> pathlib.__file__
'/usr/lib/python3.4/pathlib.py'

Is it possible you have another pathlib installed? It's available on
PyPI, maybe you got it with pip - check 'pip freeze|grep pathlib' on
the off-chance. Is your pathlib.__file__ the same as mine?

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web