Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbox2gg: cannot import name 'Q' from 'imap_tools' #3

Open
markusicu opened this issue Dec 1, 2020 · 7 comments
Open

mbox2gg: cannot import name 'Q' from 'imap_tools' #3

markusicu opened this issue Dec 1, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@markusicu
Copy link

I tried mbox2gg and it quickly failed with this:

Traceback (most recent call last):
  File "/home/username/.local/bin/mbox2gg", line 5, in <module>
    from mail2gg.cli import execute_mbox_importer
  File "/home/username/.local/lib/python3.8/site-packages/mail2gg/__init__.py", line 12, in <module>
    from imap_tools import MailBox, Q
ImportError: cannot import name 'Q' from 'imap_tools' (/home/username/.local/lib/python3.8/site-packages/imap_tools/__init__.py)
@JeffHochberg
Copy link

I'm running into exactly the same issue - I've tried with Python 3.8 on Ubuntu Linux 20.04 and Python 3.9 on macOS Big Sur.

On Ubuntu:

username@ubuntu:~$ mbox2gg --help
Traceback (most recent call last):
  File "/home/username/.local/bin/mbox2gg", line 5, in <module>
    from mail2gg.cli import execute_mbox_importer
  File "/home/username/.local/lib/python3.8/site-packages/mail2gg/__init__.py", line 12, in <module>
    from imap_tools import MailBox, Q
ImportError: cannot import name 'Q' from 'imap_tools' (/home/username/.local/lib/python3.8/site-packages/imap_tools/__init__.py)

On macOS:

username@MacBook-Air ATGP % imap2gg --help            
Traceback (most recent call last):
  File "/usr/local/bin/imap2gg", line 5, in <module>
    from mail2gg.cli import execute_imap_importer
  File "/usr/local/lib/python3.9/site-packages/mail2gg/__init__.py", line 12, in <module>
    from imap_tools import MailBox, Q
ImportError: cannot import name 'Q' from 'imap_tools' (/usr/local/lib/python3.9/site-packages/imap_tools/__init__.py)

@XaviTorello
Copy link
Owner

Sorry for the delay, I was out @markusicu and @JeffHochberg.

As a quick workaround, imap_tools should be downgraded to <=0.30.0

In 0.31.0, Q was removed (https://github.com/ikvk/imap_tools/releases/tag/v0.31.0)

I'm going to enforce it in the requirements as a workaround until the code uses the new imap_tools APIs.

XaviTorello added a commit that referenced this issue Jan 13, 2021
Related with #3, new versions of `imap_tools` deprecates the `query.Q` API
@XaviTorello
Copy link
Owner

New version has been uploaded to pypi, so just pip install mail2gg --upgrade to reach it

Could you please confirm that works as expected? @markusicu @JeffHochberg

@XaviTorello XaviTorello self-assigned this Jan 13, 2021
@XaviTorello XaviTorello added the bug Something isn't working label Jan 13, 2021
@JeffHochberg
Copy link

Hi @XaviTorello - yes I was able to upgrade mail2gg and execute mbox2gg which is what I was looking for!

I'm running into Google Groups API errors now, so I need to troubleshoot that, but I wanted to let you know that the changes you made fixed the original problem. Thanks!

@JeffHochberg
Copy link

JeffHochberg commented Jan 22, 2021

I posted a follow-up question to see if there was any additional logging that could be enabled as I was seeing a stream of 401 errors coming back from the Google Groups Migration API. It turns out that the API cannot be used to import content into an @googlegroups.com group. They only support Google Workspace (a.k.a. G Suite for Business). I tried creating a Google Workspace Group and that worked as expected!

@XaviTorello
Copy link
Owner

Great @JeffHochberg, ty for confirming it 👌

@JeffHochberg
Copy link

@XaviTorello it's up to you obviously, but I think you can close this bug as resolved...unless you're waiting for @markusicu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants