-
Notifications
You must be signed in to change notification settings - Fork 52
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
TypeError: cannot pickle '_io.TextIOWrapper' object #112
Comments
It seems to be caused by:
which is called by |
Actually, it seems to be due to passing the file hander in the Changing:
to:
Fixes the issue. It appears that the log file isn't actually written to by |
Thank you so much for your reply.
Where should I change that line?
Thanks once again
Ivan
…On Sat, Dec 19, 2020 at 7:27 AM Nick Youngblut ***@***.***> wrote:
Actually, it seems to be due to passing the file hander in the args['log']
variable to species_pileup() via utility.parallel(). The file hander
can't be serialized.
Changing:
def pysam_pileup(args, species, contigs):
start = time()
print("\nCounting alleles")
args['log'].write("\nCounting alleles\n")
# run pileups per species in parallel
argument_list = []
to:
def pysam_pileup(args, species, contigs):
start = time()
print("\nCounting alleles")
args['log'].write("\nCounting alleles\n")
args['log'].close() # new line
# run pileups per species in parallel
argument_list = []
Fixes the issue. It appears that the log file isn't actually written to by
species_pileup anyway. I'll submit a PR
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#112 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APD5TZLAWRNY7DXMTCYWR6TSVSS5BANCNFSM4VAJBYCQ>
.
|
Check out the PR edits: #113 |
Hi Nick,
thanks for the input, but adding the line as you suggested caused the run
to an early finish with this message:
IndentationError: unindent does not match any outer indentation level
Regarding the gene run, the message below is normal?
Computing coverage of pangenomes
E::idx_fin_and_load Could not retrieve index file for
'midas_output//genes/temp/pangenomes.bam'
…On Sat, Dec 19, 2020 at 10:18 AM Nick Youngblut ***@***.***> wrote:
Check out the PR edits: #113 <#113>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#112 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APD5TZOKQIMW76MDI66KVNDSVTG3VANCNFSM4VAJBYCQ>
.
|
My editor defaults to spaces, but MIDAS is written all with tabs. This caused the indentation error. I've fixed it. Also, I added a pop for the log variable, since it appears that closing the file handler didn't actually fix the serialization error. It should work now. At least, it works for me. There's no CI for the PRs, so it's untested for a broader set of envs (eg., different version of Ubuntu), but it should work. |
…r multithreading as discussed in snayfach#112 and snayfach#79 but the suggested solution of close() does not work. So I just delete it.
I tried this (although del instead of pop). This works for me. |
Hello, running
Goes well but in the end, I get:
E::idx_fin_and_load Could not retrieve index file for 'midas_output//genes/temp/pangenomes.bam'
And then when I run:
Goes well but in the end, I get:
TypeError: cannot pickle '_io.TextIOWrapper' object
Can someone help me with that?
Python 3.8.5
The text was updated successfully, but these errors were encountered: