AttributeError: module 'posixpath' has no attribute 'sep'
fullonic opened this issue · 2 comments
Hi,
I'm having an AttributeError: module 'posixpath' has no attribute 'sep'
because this if
statement. I'm using python 3.10.4.
I'm not using pytz
directly, but instead, I'm profiling a web app and that happens when I start the profiler (scalene) with scalene app.py
and PyBabel calls pytz
. If needed I can paste here the traceback.
However, after taking a look at the os
module, indeed there isn't an os.path.sep
attribute. But there is os.sep
or os.pathsep
. In this case, I think the most appropriate method would be the os.sep
because it returns the OS path separator. If this is a real issue with pytz
, I'm happy to provide PR to fix it.
Cheers
I think you are correct in that os.path.sep could fail on some platforms. Tests are happy with the switch to os.sep.
Hi,
I have the same problem in the zipfile.py module.
os.path.sep returns {AttributeError}module 'posixpath' has no attribute 'sep' so I modified the file in
def _extract_member(self, member, targetpath, pwd):
"""Extract the ZipInfo object 'member' to a physical
file on the path targetpath.
"""
by replacing os.path.sep by os.sep (which returns the correct value '/' on a mac operating system).
It solve the problem both for zipfile open and extract methods.