question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not getting all results when using headers_only

See original GitHub issue

Hi,

I wanted to get a quick list of the uids of messages in a mailbox. Using:

msg_uids = [msg.uid for msg in mailbox.fetch()]

I get a list with the uids for all messages in the mailbox, in length equal to:

mailbox.folder.status()['MESSAGES']

But when I do the same with:

msg_uids = [msg.uid for msg in mailbox.fetch(headers_only=True)]

I only get to see a few of them…

I would expect either all uids to be returned or none at all, since the uid is not a part of the headers, right?

Similarly, something like:

for msg in mailbox.fetch(Q(uid=xxx),headers_only): print(msg.headers)

only works for the uids from the list returned by the previous command. Without the headers_only, it works for all the uids from that mailbox.

I have not yet looked into the imap_tools code, but I wanted to mention it here already anyway since this looks like strange behavior to me. At least, this is not what I would expect, and even if the usage seems strange (why would I need to use the uids when I can use Q to query), using the headers_only might perhaps also have other side-effects…

Best regards, Franky

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
backeljcommented, Aug 28, 2020

Hi Vladimir,

Thanks a lot! There’s been a lot in-between, but I will check the changes somewhere next week.

– Regards,

Franky

Van: Vladimir Kaukin notifications@github.com Beantwoorden - Aan: ikvk/imap_tools reply@reply.github.com Datum: vrijdag 28 augustus 2020 om 12:43 Aan: ikvk/imap_tools imap_tools@noreply.github.com CC: Franky Backeljauw franky.backeljauw@uantwerpen.be, Author author@noreply.github.com Onderwerp: Re: [ikvk/imap_tools] Not getting all results when using headers_only (#46)

fixed https://github.com/ikvk/imap_tools/releases/tag/v0.20.0https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fikvk%2Fimap_tools%2Freleases%2Ftag%2Fv0.20.0&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063326903&sdata=DMuubWfbKVaJtc013IwdSjQg5ckiBpa9bLnbKcJ6H20%3D&reserved=0. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fikvk%2Fimap_tools%2Fissues%2F46%23issuecomment-682457461&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063326903&sdata=hr178rWjWxNqTagfiTd3UnZiBsjNvk4a0eKo52MP5dE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABJPBXL5YUVIXDCXLTAYHLDSC6C4VANCNFSM4OPX2YTA&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063336851&sdata=sNfzNPuQgClJFRbICkIc3jnJ6X%2FEyHfYjl2UfMkgPZ0%3D&reserved=0.

0reactions
ikvkcommented, Aug 28, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

angular 5 httpclient , on post , the response does not return ...
I recently moved to angular 5 and earlier the http.post was returning the response objecta s complete with headers however ...
Read more >
RESTORE HEADERONLY (Transact-SQL) - Microsoft Learn
Column name Data type Description for SQL Server backup sets BackupName nvarchar(128) Backup set name. BackupDescription nvarchar(255) Backup set description. ExpirationDate datetime Expiration date for the...
Read more >
Why do headers only appear once? · Issue #2228 - GitHub
You wouldn't get headers for every line - you'll just get headers as though no more objects are being written to the pipe....
Read more >
Extracting a field from RESTORE HEADERONLY
I can get this into a temp table by declaring every single one of the 50:ish columns, inserting into it with exec and...
Read more >
How to write a CSV file several times and write the headers ...
A choice component to select if the headers should be written or not. PROCEDURE. 1. Create a flow which receives a list of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found