Python 关于TypeError的错误:应为str、bytes或os.PathLike对象,而不是NoneType

Python 关于TypeError的错误:应为str、bytes或os.PathLike对象,而不是NoneType,python,linux,tensorflow,Python,Linux,Tensorflow,我试图通过运行一个模型来纠正英语语法 我的开发环境是Linux+Anaconda3+python3.6+cuda9.0+tensorflow1.9.0 运行模型后,测试出现以下问题: Traceback (most recent call last): File "./generate.py", line 236, in <module> main(args) File "./generate.py", line 93, in main fluency_sco

我试图通过运行一个模型来纠正英语语法

我的开发环境是Linux+Anaconda3+python3.6+cuda9.0+tensorflow1.9.0

运行模型后,测试出现以下问题:

Traceback (most recent call last):
  File "./generate.py", line 236, in <module>
    main(args)
  File "./generate.py", line 93, in main
    fluency_scorer = FluencyScorer(args.lang_model_path, args.lang_model_data)
  File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq-scripts/fluency_scorer.py", line 58, in __init__
    self.task = tasks.setup_task(self.args)
  File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq/fairseq/tasks/__init__.py", line 19, in setup_task
    return TASK_REGISTRY[args.task].setup_task(args)
  File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq/fairseq/tasks/language_modeling.py", line 90, in setup_task
    dictionary = Dictionary.load(os.path.join(args.data, 'dict.txt'))
  File "/home/gpower/anaconda3/envs/tf/lib/python3.6/posixpath.py", line 78, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

我应该如何解决这个问题

查看一些代码可能会有所帮助,但a=os.fspatha中的a变量的类型似乎是NoneType。为了使用os.fspath函数,a变量应该是字符串、字节或类似os.PATH的对象

您可以在os.fspath函数上查看Python文档: