Python and lotus notes

Dave Angel davea at davea.name
Mon Apr 20 06:05:58 EDT 2015


On 04/20/2015 04:29 AM, gianluca.pucci at gmail.com wrote:
> Hi,
>

Hi and welcome.
I don't know Lotus Notes, but i can at least comment on some of your 
code, pointing out at least some problems.

> i am having a problem when i try to access lotus notes with python, think i do all ok but it seems something is going wrong because i can't print any db title even if i've opened the .nsf file.
>
> My code:
>
> import win32com.client
> from win32com.client import Dispatch
>
> notesServer='Mail\wed\new\IT'

You're using backslashes in literal strings when there's nothing escaped 
there.  So you need to either double them or use a raw string.  It's 
also possible that you could use forward slashes, but I can't be sure.

I'd simply use
notesServer = R'Mail\wed\new\IT'


> notesFile= 'Apps\Mydb.nsf'
> notesPass    = 'mypass'
>
> session = Dispatch('Lotus.NotesSession')
> session.Initialize(notesPass)
> print "----------------"
>
> db = session.getDatabase(notesServer, notesFile)
>
> print db.Open

You forgot the parentheses.  So you're not calling the Open function, 
you're just printing it.

> print db.IsOpen
> print db.Title
>
> but i receve:
>
> <bound method CDispatch.Open of <COMObject <unknown>>>
> False
>
> Please can u help me?
> GL
>

There may be other things, but if you fix the three lines, it'll 
probably get further.

-- 
DaveA



More information about the Python-list mailing list