묻고 답해요
141만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
PutFieldText 함수 사용 관련 질문
def 필드삽입(index, value): field_list = ["이름", "성별", "생일", "취미"] for idx, field in enumerate(field_list): hwp.PutFieldText(f"{field}{{{{{index}}}}}", value[idx])이 코드에서 다음과 같이 필드 이름을 넣어야 하는 이유를 알려 주시면 감사하겠습니다. 결국 필드 이름만 필요한 것 같은데 index가 왜 필요하며 괄호의 갯수는 왜 여러개인지 잘 모르겠습니다.{field}{{{{{index}}}}}
-
해결됨직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
win32 에러 관련
import win32com.client as win32 hwp = win32.gencache.EnsureDispatch("hwpframe.hwpobject") 위의 코드를 실행 후 아래의 에러 메시지가 나오는데 어떻게 해결해야 할까요? hwp = win32.gencache.EnsureDTraceback (most recent call last): File "d:\GTD\02. 프로젝트\파이썬\한글\hwp_field_test.py", line 4, in <module> hwp = win32.gencache.EnsureDispatch("hwpframe.hwpobject") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\gencache.py", line 621, in EnsureDispatch disp = win32com.client.Dispatch(prog_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\__init__.py", line 119, in Dispatch return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\__init__.py", line 47, in __WrapDispatch klass = gencache.GetClassForCLSID(resultCLSID) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\gencache.py", line 200, in GetClassForCLSID mod = GetModuleForCLSID(clsid) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\gencache.py", line 245, in GetModuleForCLSID mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\gencache.py", line 287, in GetModuleForTypelib AddModuleToCache(typelibCLSID, lcid, major, minor) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\win32com\client\gencache.py", line 661, in AddModuleToCache SetTypelibForAllClsids(mod.CLSIDToClassMap) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'win32com.gen_py.7D2B6F3C-1D95-4E0C-BF5A-5EE564186FBCx0x1x0' has no attribute 'CLSIDToClassMap'ispatch("hwpframe.hwpobject")