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


Groups > comp.lang.python > #83155

Re: pathlib type error

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'error:': 0.07; 'python3': 0.07; 'operand': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'jan': 0.12; 'amd64': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:type': 0.16; 'typeerror:': 0.16; 'sat,': 0.16; 'wrote:': 0.18; "skip:' 30": 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; '"",': 0.31; '>>>>': 0.31; 'file': 0.32; 'another': 0.32; 'linux': 0.33; '(most': 0.33; 'maybe': 0.34; 'received:google.com': 0.35; 'machine.': 0.36; 'possible': 0.36; 'pm,': 0.38; 'recent': 0.39; 'unable': 0.39; 'skip:p 20': 0.39; 'more': 0.64; '2014,': 0.84; '2015': 0.84; 'type(s)': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=iU1zSU2B6hjx1sNvIKyBjq/uloW+dMpBq7e1uyF+d24=; b=uBsc/0V14Lb6oet8jzLDcS25k4OM9UDWUpXQnZreu+ZO0F+RtooRoAB9aOuICM4YTS I6BahvALNAYIJta12Xs4Tbku0aN/p8ajN/9navwaSyfElxFD+lqdVwj+wnmkRpwAbD9v NmMtZZHqT5+JpUu9KIgCWkWXXUv2cu/TbRdFYozrJW1fvO66MPCuNnbS0jqGXr97fF5e UCL0Xe/dBU8FvveVwJQH7Z37tX0voHbfQaKlv/eW4s2R+zZtV/1YUE1fhH5Xm03uoAXx Pl1NF9tfGaSm+f3ThwSuLPUcVNphQUJzBdpJdTunnp7lYx6i09SfOsSJRtuSw2hRPxeM pJzQ==
MIME-Version 1.0
X-Received by 10.107.134.39 with SMTP id i39mr71245567iod.53.1420286780613; Sat, 03 Jan 2015 04:06:20 -0800 (PST)
In-Reply-To <CAHRCC4=TE7Ep7GPVAw-3pFnzSzopHjkJPLgK-NbmmFkSMqg-eQ@mail.gmail.com>
References <CAHRCC4=TE7Ep7GPVAw-3pFnzSzopHjkJPLgK-NbmmFkSMqg-eQ@mail.gmail.com>
Date Sat, 3 Jan 2015 23:06:20 +1100
Subject Re: pathlib type error
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17348.1420286783.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420286783 news.xs4all.nl 2956 [2001:888:2000:d::a6]:56471
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83155

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web