python xlwings 模块错误:OSError: [WinError -2147467259] 未指定错误

问题描述 投票:0回答:2

我只是尝试使用 xlwings 从 python 写入 Excel 文件。通过遵循简单的代码本身面临的错误。我已经安装了最新版本的Python 3.90和

xlwings 0.20.8
。使用pycharm-community-2020.2.3编写代码。

下面给出的是代码以及运行此代码时显示的错误。

代码:

import xlwings as xw


excel_file = "test.xlsx"

wb = xw.Book(excel_file)

wb.sheets("Sheet1").range("A2").value = "Hello"

错误:

Traceback (most recent call last):
  
File "C:/Users/Siva/.conda/Sample/Test.py", line 5, in <module>
    wb = xw.Book(excel_file)
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\main.py", line 533, in __init__
    for wb in app.books:
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\main.py", line 374, in books
    return Books(impl=self.impl.books)
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\_xlwindows.py", line 397, in books
    return Books(xl=self.xl.Workbooks)
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\_xlwindows.py", line 313, in xl
    self._xl = get_xl_app_from_hwnd(self._hwnd)
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\_xlwindows.py", line 222, in get_xl_app_from_hwnd
    ptr = accessible_object_from_window(child_hwnd)
  
File "C:\ProgramData\Anaconda3\envs\Projects\lib\site-packages\xlwings\_xlwindows.py", line 190, in accessible_object_from_window
    res = oledll.oleacc.AccessibleObjectFromWindow(
  
File "_ctypes/callproc.c", line 948, in GetResult

OSError: [WinError -2147467259] Unspecified error
python pycharm xlwings python-3.9
2个回答
0
投票
service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
        <service android:name="com.google.firebase.components.ComponentDiscoveryService">
            <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar" />
        </service>
        <receiver android:exported="true" android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.kyz.games.hepyek" />
            </intent-filter>
        </receiver>

-1
投票

你有没有得到答案?我也有同样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.