TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'


Error

Traceback (most recent call last):

File "", line 1, in

File "c:\users\13161\desktop\github项目\universalrotation-main\UniversalRotation.py", line 238, in rotate_LOF_ETF

rotate_fund_by_premium_rate_and_20net_asset_value('20天净值增长率和溢价率轮动LOF、ETF和封基','G1', 10)

File "c:\users\13161\desktop\github项目\universalrotation-main\UniversalRotation.py", line 131, in rotate_fund_by_premium_rate_and_20net_asset_value

pysnowball.set_token(get_xq_a_token())

File "c:\users\13161\desktop\github项目\universalrotation-main\UniversalRotation.py", line 100, in get_xq_a_token

cj = browser_cookie3.load()

File "E:\python\lib\site-packages\browser_cookie3_init_.py", line 897, in load

for cookie in cookie_fn(domain_name=domain_name):

File "E:\python\lib\site-packages\browser_cookie3_init_.py", line 882, in firefox

return Firefox(cookie_file, domain_name).load()

File "E:\python\lib\site-packages\browser_cookie3_init_.py", line 594, in init

cookie_file = cookie_file or self.find_cookie_file()

File "E:\python\lib\site-packages\browser_cookie3_init_.py", line 665, in find_cookie_file

cookie_files = glob.glob(os.path.join(Firefox.get_default_profile(user_data_path), 'cookies.sqlite')) \

File "E:\python\lib\site-packages\browser_cookie3_init_.py", line 638, in get_default_profile

return profile_path if absolute else os.path.join(os.path.dirname(profiles_ini_path), profile_path)

File "E:\python\lib\ntpath.py", line 117, in join

genericpath._check_arg_types('join', path, *paths)

File "E:\python\lib\genericpath.py", line 152, in _check_arg_types

raise TypeError(f'{funcname}() argument must be str, bytes, or '

TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

求协助解决,谢谢!

该回答引用ChatGPT
请参考下面的解决方案,如果可行还请 点击 采纳 ,感谢!

这是一个代码错误。具体来说,是Firefox.get_default_profile()函数的返回值是None,然后在下面的语句中传递给了os.path.join,导致了类型错误。
为了解决这个问题,请检查Firefox.get_default_profile()函数的返回值是否是正确的。如果不是,请更正。如果是,请查找并修复os.path.join中的问题。

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^