Open excel file through Python win32com which having foreign language in a filename
<p>I am trying to open excel file through win32com. But when I run a code with foreign(Korean) language then it gives an error which wans't happened with a english filename.</p>

<p>How do I solve this problem?</p>

<pre><code>#-*- coding: utf-8 -*-
import os
import win32com.client

xl=win32com.client.Dispatch("Excel.Application")
xl.Visible = True

xl.Workbooks.Open(os.path.join(os.getcwd(), "Nikkei225_10ì.xlsm"))

xl.Application.Quit() # Comment this out if your excel script closes
del xl
</code></pre>

<p>Here is an error message:</p>

<pre><code>com_error: (-2147352567, '\xbf\xb9\xbf\xdc\xb0\xa1 
\xb9\xdf\xbb\xfd\xc7\xdf\xbd\xc0\xb4\xcf\xb4\xd9.', (0, u'Microsoft Office 
Excel', u"'C:\\Users\\Jongho\\dev_jhk\\VNI Automation Pilot Test\\Nikkei225_10??
xlsm.xlsx'\uc744(\ub97c) \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. 
\ud30c\uc77c \uc774\ub984\uc758 \ucca0\uc790\uc640 \ud30c\uc77c 
\uc704\uce58\uac00 \uc815\ud655\ud55c\uc9c0 
\ud655\uc778\ud558\uc2ed\uc2dc\uc624.\n\n\ucd5c\uadfc\uc5d0 \uc0ac\uc6a9\ud55c
\ud30c\uc77c \ubaa9\ub85d\uc5d0 \uc788\ub294 \ud30c\uc77c\uc744 
\uc5f4\ub824\uba74 \ud30c\uc77c\uc758 \uc774\ub984\uc774 
\ubcc0\uacbd\ub418\uac70\ub098 \ud30c\uc77c\uc774 \uc774\ub3d9 \ub610\ub294 
\uc0ad\uc81c\ub418\uc9c0 \uc54a\uc558\ub294\uc9c0 
\ud655\uc778\ud558\uc2ed\uc2dc\uc624.", u'C:\\Program Files\\Microsoft 
Office\\Office12\\1042\\XLMAIN11.CHM', 0, -2146827284), None)
</code></pre>

<p>It was an encoding problem.</p>

<pre><code>#-*- coding: utf-8 -*-
import os
import win32com.client

xl=win32com.client.Dispatch("Excel.Application")
xl.Visible = True

xl.Workbooks.Open("C:\\Users\\Jongho\\dev_jhk\\VNI Automation Pilot Test\\Nikkei225_10\xbf\xf9.xlsm")

xl.Application.Quit() # Comment this out if your excel script closes
del xl
</code></pre>

python excel win32com