首页 > 解决方案 > Python问题:TypeError:强制转换为Unicode:需要字符串或缓冲区,找到NoneType

问题描述

我正在尝试在使用 python 2.7 的 conda 环境中使用 DeepChem 库版本 2.0.0。我不断遇到这个错误:

Traceback (most recent call last):
  File "test_run_benchmark_models.py", line 30, in <module>
    seed=123)
  File "/home/ha01994/miniconda2/envs/project/lib/python2.7/site-packages/deepchem/molnet/run_benchmark.py", line 153, in run_benchmark
    featurizer=featurizer, reload=reload)
  File "/home/ha01994/miniconda2/envs/project/lib/python2.7/site-packages/deepchem/molnet/load_function/bace_datasets.py", line 80, in load_bace_classification
    save_dir = os.path.join(data_dir, "bace_c/" + featurizer + "/" + str(split))
TypeError: coercing to Unicode: need string or buffer, NoneType found

这是第 80 行附近的代码:

def load_bace_classification(featurizer='ECFP', split='random', reload=True):
    """Load bace datasets."""
    # Featurize bace dataset
    print("About to featurize bace dataset.")
    data_dir = deepchem.utils.get_data_dir()
    if reload:
        save_dir = os.path.join(data_dir, "bace_c/" + featurizer + "/" + str(split))

    dataset_file = os.path.join(data_dir, "bace.csv")

    if not os.path.exists(dataset_file):
        deepchem.utils.download_url('http://deepchem.io.s3-website-us-west-1.amazonaws.com/datasets/bace.csv'
    )

任何帮助,将不胜感激。谢谢!

标签: python

解决方案


推荐阅读