I can import CLR, but not imaplib. Although imaplib is part of the standard python library, and I suppose I didn't need CLR.
I also tried different combinations of case of the word "imaplib", since the import statement is case sensitive.
Currently I have the latest Python version 25, and installed the latest PythonNet afterwards (PythonNet 1.0 release candidate 2).
Also tried to include the path to the C:\Python25\Lib in the systemvariable PATH, where imaplib.py resides.
Furthermore I included C:\Program Files\PythonNet in the same systemvariable, but that's nog part of the problem I guess.

Date: Tue, 10 Apr 2007 19:39:43 -0700
From: dvpdiner2@yahoo.com
Subject: Re: [Python.NET] Unable to import library imaplib
To: kris_beyers@hotmail.com
CC: pythondotnet@python.org

Did you use (in Python)

>>> import clr

to import the Common Language Runtime and support .NET assemblies?

Uru Live IRC Chat: unreal.JustIRC.net #uru

----- Original Message ----
From: Kris Beyers <kris_beyers@hotmail.com>
To: pythondotnet@python.org
Sent: Tuesday, April 10, 2007 1:31:35 PM
Subject: [Python.NET] Unable to import library imaplib

I'm trying to make a python script (which would be called from a C# application) and communicates with an IMAP server.
Passing variables from C# to python and back is no problem, but when I type "import imaplib" on top of the python script to support IMAP, the script fails to run at line with following code: "func.Invoke(arguments)". Showing error message in the C# developer: "<null reference>".
I also tried to call PythonEngine.ImportModule("imaplib") first, but no change.
Is there a way to import the library? Thank you in advance.
Tip: Just found out about an amazing C# developer http://www.sharpdevelop.net (open source)
try {
 string imapUser = "kris";
 string imapPassword = "a password";
 PyObject[] arguments = new PyObject[2];
 arguments[0] = PyObject.FromManagedObject(imapUser);
 arguments[1] = PyObject.FromManagedObject(imapPassword);
 PyObject pyportal = PythonEngine.ImportModule("PyPortal");
 PyObject func = pyportal.GetAttr("invoker");
 PyObject result = func.Invoke(arguments);
 this.label1.Text = result.ToString();
} catch (Exception err) {
 this.label1.Text = err.Message.ToString();
The file PyPortal.py
import imaplib                      #  <-- causes error
def invoker(imapUser, imapPassword):
    messages = []
    M = imaplib.IMAP4('imap.next.mail.yahoo.com')
    M.login(imapUser, imapPassword)
    typ, data = M.search(None, 'ALL')
    for num in data[0].split():
        typ, data = M.fetch(num, '(RFC822)')
        messages.append('Message %s\n%s\n' % (num, data[0][1]))
    return '<delimiter>'.join(messages)

het ultieme online mailprogramma! Ontdek Windows Live Hotmail,
Python.NET mailing list - PythonDotNet@python.org

Now you can have a huge leap forward in email: get the new Yahoo! Mail.

het ultieme online mailprogramma! Ontdek Windows Live Hotmail,