josw123 / dart-fss

한국 금융감독원에서 운영하는 다트(Dart) 시스템 크롤링을 위한 라이브러리
https://github.com/josw123/dart-fss
MIT License
322 stars 110 forks source link

OSError: [Errno 45] Operation not supported: '/home/nagat' #2

Closed lifesailor closed 5 years ago

lifesailor commented 5 years ago

MAC에서 재무제표 관련 부분 실행 시 다음 오류가 발생합니다.

lifesailor commented 5 years ago

OSError Traceback (most recent call last)

in 3 4 # 2012년부터 연간보고서에 포함된 연결 재무상태표 검색 ----> 5 ci_annual = samsung_electronics.get_financial_statement(start_dt='20120101', fs_tp='ci') /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/crp.py in get_financial_statement(self, start_dt, end_dt, fs_tp, separate, report_tp, lang, show_abstract, show_class, show_depth, show_concept, separator) 186 report_tp=report_tp, lang=lang, show_abstract=show_abstract, 187 show_class=show_class, show_depth=show_depth, show_concept=show_concept, --> 188 separator=separator) 189 190 /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/fs.py in search_financial_statement(crp_cd, start_dt, end_dt, fs_tp, separate, report_tp, lang, show_abstract, show_class, show_depth, show_concept, separator) 452 for idx, _ in enumerate(reports): 453 last_report = reports[idx] --> 454 last_xbrl = last_report.xbrl 455 456 if last_xbrl is not None: /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/reports.py in xbrl(self) 145 """DartXbrl or list of DartXbrl: DartXbrl 반환""" 146 if self._xbrl is None: --> 147 self.load_xbrl() 148 return self._xbrl 149 /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/reports.py in load_xbrl(self) 224 225 if self._xbrl_url is not None: --> 226 xbrl = get_xbrl_from_website(self._xbrl_url) 227 if len(xbrl) == 1: 228 self._xbrl = xbrl[0] /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/xbrl.py in get_xbrl_from_website(url) 771 xbrl_file = search_file(extract_path) 772 for file in xbrl_file: --> 773 xbrl = get_xbrl_from_file(file) 774 xbrl_list.append(xbrl) 775 return xbrl_list /anaconda3/envs/investment/lib/python3.6/site-packages/dart_fss/xbrl.py in get_xbrl_from_file(file_path) 747 if not os.path.exists(arelle_app_dir): 748 os.makedirs(arelle_app_dir) --> 749 model_xbrl = Cntlr.Cntlr().modelManager.load(file_path) 750 filename = file_path.split('\\')[-1] 751 return DartXbrl(filename, model_xbrl) /anaconda3/envs/investment/lib/python3.6/site-packages/arelle/Cntlr.py in __init__(self, hasGui, logFileName, logFileMode, logFileEncoding, logFormat) 233 # shutil.rmtree(self.userAppDir) 234 if not os.path.exists(self.userAppDir): --> 235 os.makedirs(self.userAppDir) 236 237 # load config if it exists /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 208 if head and tail and not path.exists(head): 209 try: --> 210 makedirs(head, mode, exist_ok) 211 except FileExistsError: 212 # Defeats race condition when another thread created the path /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 208 if head and tail and not path.exists(head): 209 try: --> 210 makedirs(head, mode, exist_ok) 211 except FileExistsError: 212 # Defeats race condition when another thread created the path /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 208 if head and tail and not path.exists(head): 209 try: --> 210 makedirs(head, mode, exist_ok) 211 except FileExistsError: 212 # Defeats race condition when another thread created the path /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 208 if head and tail and not path.exists(head): 209 try: --> 210 makedirs(head, mode, exist_ok) 211 except FileExistsError: 212 # Defeats race condition when another thread created the path /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 208 if head and tail and not path.exists(head): 209 try: --> 210 makedirs(head, mode, exist_ok) 211 except FileExistsError: 212 # Defeats race condition when another thread created the path /anaconda3/envs/investment/lib/python3.6/os.py in makedirs(name, mode, exist_ok) 218 return 219 try: --> 220 mkdir(name, mode) 221 except OSError: 222 # Cannot rely on checking for EEXIST, since the operating system OSError: [Errno 45] Operation not supported: '/home/nagat'
josw123 commented 5 years ago

XBRL 파일 처리를 위해 사용되는 Arelle 라이브러리에 버그가 있어서 그렇습니다. ~/Library/Application Support 폴더 밑에 Arelle 폴더를 만드시면 오류가 해결됩니다. (Full path: /Users/사용자명/Library/Application Support/Arelle)

다음버전에 dart-fss 패키지에서 폴더 체크후 직접 생성하는 코드를 집어 넣도록 하겠습니다.

lifesailor commented 5 years ago

감사합니다.