0

I ve a problem with Atom text editor. I am trying to access IMAP4_SSL attribute in imaplib package:

import imaplib
...
conn = imaplib.IMAP4_SSL("some.mail.server")

Which raises the following error:

AttributeError: module 'imaplib' has no attribute 'IMAP4_SSL'

I was trying to find cause for it. After trying the code above from conda prompt, the error was gone. So, I thought it should have something to do with the editor or "script" package of Atom. I checked sys.path and sys.version from Atom and there were no problems. python.coffee configuration below:

exports.Python =
  'Selection Based':
    command: 'python'
    args: (context) ->
      code = context.getCode()
      tmpFile = GrammarUtils.createTempFileWithCode(code)
      return ['-u', tmpFile] 

Edit: And I think the package imported successfully, because I can access other attributes of it like IMAP

Edit2: Most probably my problem is related with the following prompt which I get when I launch python in Windows Powershell:

This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

I've already tried to run activate.bat script but did not work out and please notice that Anaconda is installed into another drive with Windows. But the following path is already included in environment variables:

D:/anaconda
zodiac645
  • 191
  • 1
  • 3
  • 14
  • 1
    Cannot reproduce. If you look into [source for imaplib](https://github.com/python/cpython/blob/3.9/Lib/imaplib.py), you'll see that existence of IMAP4_SSL is conditional. Documentation says "to use this class you need a socket module that was compiled with SSL support". That's probably your problem – h4z3 Feb 16 '21 at 19:16
  • Yes yo are right indeed `print(imaplib.HAVE_SSL)` prints `False` – zodiac645 Feb 16 '21 at 19:29
  • So the problem is importing `ssl` package I suppose `ImportError: DLL load failed while importing _ssl: The specified module could not be found.` – zodiac645 Feb 16 '21 at 19:32

1 Answers1

0

Turns out my answer was here and nothing was wrong with my conda environment

https://stackoverflow.com/a/49737729/7941061

zodiac645
  • 191
  • 1
  • 3
  • 14