[英]Python - win32com.client: pywintypes.com_error when trying to open a (large) Excel
[英]'Could not open the ID file' when using win32com.client in python
我使用win32com.client從Python連接到Lotus Notes時遇到問題。
我正在使用以下代碼:
import win32com.client
import csv # imports the csv module
import sys # imports the sys module
import re
notesServer = "AALMBX01/Server/..."
notesPass = "PASS"
#Connect to notes database on server
notesSession = win32com.client.Dispatch('Lotus.NotesSession')
notesSession.Initialize(notesPass)
db_name = 'mail\iizs.nsf'
db = notesSession.getDatabase(notesServer, db_name)
view = db.GetView("($All)")
doc = view.getFirstDocument()
我得到以下錯誤:
(-2147352567,'發生異常。',(0,u'NotesSession',u'注意錯誤:密碼錯誤。(密碼區分大小寫-請確保使用正確的大小寫。)'
還嘗試將密碼留空,並在界面中禁用“ LN應用程序的請求密碼”。 使用空白密碼,我收到以下錯誤消息:
(-2147352567,'發生異常。',(0,u'NotesDatabase',u'數據庫AALMBX01 / Server / ... !! mail \\ iizs.nsf尚未打開'
我嘗試了以下方法:
錯誤仍然相同。 嘗試將user.id也復制到系統文件夾之一(system32)-也沒有幫助。
有什么建議么?
import win32com.client
import pywintypes
from win32com.client import Dispatch
from win32com.client import constants
notesSession = Dispatch('Lotus.NotesSession')
dir(constants)
dir(notesSession)
Password = 'S3cretP455w0rd'
Server = 'yourserver/yourapp' # yourserver = '' if local
scPath = 'view.nsf'
notesSession.Initialize(Password)
HTH!
另外,發生在我身上的一個“陷阱”是網絡驅動器-如果您的NOTES.INI文件包含網絡路徑,請嘗試將其刪除並添加到Python代碼中:
[code]
import os
os.system('net use w: /delete')
os.system('net use w: \\\\apps\\NotesFolder')
[/code]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.