Closed GoogleCodeExporter closed 9 years ago
Tested this on Python 3.3 and everything works fine while on Python 2.7 I can
work around the error by using name.encode('utf8').
It looks like the difference in behavior between mkdir and statvfs is caused by
how they treat the paths given as input:
- mkdir:
http://hg.python.org/cpython/file/0152152b09d0/Modules/posixmodule.c#l2651
- statvfs:
http://hg.python.org/cpython/file/0152152b09d0/Modules/posixmodule.c#l7449
This looks like a Python bug to me (statvfs should use PyArg_ParseTuple(args,
"et")).
I will file an issue on the Python bug tracker.
As for what concerns psutil I don't think we should take any action.
Original comment by g.rodola
on 9 Aug 2013 at 10:04
I tried using name.encode('utf8') on Windows, but that did not work -
$ cat test.py
# coding: utf-8
from __future__ import unicode_literals
import os
from psutil import disk_usage
name = "ƒőő"
os.mkdir(name)
disk_usage(name.encode('utf8'))
$ python test.py
Traceback (most recent call last):
File "test.py", line 8, in <module>
disk_usage(name.encode('utf-8'))
File "c:\users\sync\sync\vendor\psutil\psutil\__init__.py", line 1020, in disk
_usage
return _psplatform.get_disk_usage(path)
File "c:\users\sync\sync\vendor\psutil\psutil\_psmswindows.py", line 98, in ge
t_disk_usage
raise OSError(errno.ENOENT, "No such file or directory: '%s'" % path)
OSError: [Errno 2] No such file or directory: 'ƒőő'
Original comment by kunalpar...@gmail.com
on 9 Aug 2013 at 10:39
Ah OK! Well, I think we can at least fix that on Windows.
Original comment by g.rodola
on 9 Aug 2013 at 11:43
Windows fixed in revision 9d233da8d725.
os.statvfs() bug is now tracked at: http://bugs.python.org/issue18695.
At this point I think psutil should expose its own fixed version of statvfs()
on Python 2 and keep using the one provided by the os module on Python 3.
Original comment by g.rodola
on 9 Aug 2013 at 12:11
I added a pure python workaround for POSIX as of revision c8451ddcf746.
Re-exposing statvfs() from scratch was too much work.
I consider this fixed.
Original comment by g.rodola
on 9 Aug 2013 at 1:26
Shameless Plug: I open sourced a project that we have used quite successfully
to test our application for Unicode characters. You may find it useful to test
all psutil APIs. Its available at https://pypi.python.org/pypi/rotunicode.
Original comment by kunalpar...@gmail.com
on 22 Aug 2013 at 7:34
Original comment by g.rodola
on 28 Sep 2013 at 10:06
Closing out as fixed. Release 1.1.0 is now available for download.
Original comment by g.rodola
on 28 Sep 2013 at 5:32
Original issue reported on code.google.com by
kunalpar...@gmail.com
on 9 Aug 2013 at 9:17