= 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' in
Daiyue Weng wrote:
> 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 t
On Tue, Sep 13, 2016 at 9:19 PM, Daiyue Weng wrote:
> Could you give me an example of doing this using os.path.split and
> os.path.join?
>
> thanks
Sure, but I'm keeping this on list.
os.path.split basically does the same thing you do.
# maintaining your non-PEP-8 names
rgument '\\' of the 2nd rsplit,
>
> Expected type 'optional[bytes]' got 'str' instead
>
Well, the first thing I'd do is use os.path.split instead of rsplit :)
Or alternatively, os.path.join using dot-dot. And if that's not
sufficient, I'd reach for pathlib.
Whichever way I do it, I wo
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