PyYAML을 사용하여 YAML 파일을 덤프하고로드하는 데 문제가 있습니다.PyYAML 덤프 오브젝트 경로
두 개의 분리 된 응용 프로그램 A와 B가 있습니다. YAML 파일을 A에 덤프하고 나중에로드하여 B에서 사용하고 싶습니다. 그러나 개체 경로가 올바르지 않은 것 같습니다. dump.py에서
A-folder
dump.py
B-folder
the_module.py
use.py
, 나는이 같은 코드 : 나는 use.py.이 YAML 파일을 사용할 필요가 그런
!!python/object:B-folder.the_module.the_class
attribute_0: !!python/long '10'
attribute_1: !!python/long '10'
: 그것은 YAML 파일을 제공
yaml.dump(the_class_instance, file_stream, default_flow_style=False)
하지만 the_module.the_module.the_class의 인스턴스로 제대로로드 할 수 없습니다. 그것은 말한다 :
cannot find module 'B-folder.the_module' (No module named B-folder.the_module)
내가 그냥 B-folder.adaptor의 메소드를 호출하지만 여전히 같은 결과를 제공 dump.py에서 다른 모듈의 B-folder.adaptor에 덤핑을하려고 노력했다.
어떻게 처리하나요? 감사.