Hi, I have the following piece of code,

rootPath = os.path.abspath(__file__)

rootPath = (rootPath.rsplit('\\', 1)[0]).rsplit('\\', 1)[0]


PyCharm inspection gave me warning on argument '\\' of the 2nd rsplit,

Expected type 'optional[bytes]' got 'str' instead


If I changed it to,

rootPath = (rootPath.rsplit('\\', 1)[0]).rsplit(b'\\', 1)[0]

Python game me errors,

TypeError: Can't convert 'bytes' object to str implicitly

How to fix it?


cheers
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to