ValueError: error during iteration "Pysam" - python

I have ran into this error and I am having trouble resolving it. Here is it what I get:
Traceback (most recent call last):
File "afile.py", line 100, in <module>
for col in bam.pileup( chrm, ps1, ps1+1,truncate=True):
File "pysam/calignmentfile.pyx", line 2060, in pysam.calignmentfile.IteratorColumnRegion.__next__
(pysam/calignmentfile.c:23305)
ValueError: error during iteration
Thanks a lot in advance.

i hit this recently. the root cause in my case was that the .bai bam index file was out of date. after i regenerated it with samtools index XXX.bam, the pysam crash went away.

Related

Urequests micropython gets stuck

It gets stuck on the first urequests.get()
I have tried EVERYTHING, it prompts me this error
`Traceback (most recent call last):
File "<stdin>", line 26, in <module>
File "urequests.py", line 180, in get
File "urequests.py", line 76, in request
OSError: -1
`
Help please
Tried reinstalling the uf2, flash nuking it, importing manually urequests, NOTHING, i cant finish my prject without this.

KeyError: 'CUDA_VISIBLE_DEVICES'

today I asked this question concerning problems with PyTorch running on my GPU. In response, someone kindly suggested running the following code:
import os
num_gpus = os.environ['CUDA_VISIBLE_DEVICES'].split(',').__len__()
os.environ['CUDA_VISIBLE_DEVICES'] = ','.join(f'{i}' for i in range(num_gpus))
However, after running that second line, unfortunately I get another error:
num_gpus = os.environ['CUDA_VISIBLE_DEVICES'].split(',').__len__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hbp/anaconda3/lib/python3.8/os.py", line 675, in __getitem__
raise KeyError(key) from None
KeyError: 'CUDA_VISIBLE_DEVICES'
I tried to look it up, but couldn't find anything helpful.
Does anyone have an idea what I could try? The question I linked to may have relevant info.

Tuple index out of range : Audio to spectrogram

I am trying to run an audio to spectrogram script, namely:
https://github.com/grrrr/nsgt/tree/master/examples
When I try python spectrogram.py myaudio.wav
I get the error:
Traceback (most recent call last):
File "spectrogram.py", line 111, in <module>
coefs = assemble_coeffs(c, ncoefs)
File "spectrogram.py", line 27, in assemble_coeffs
out = np.empty((ncoefs,cq0.shape[1],cq0.shape[2]), dtype=cq0.dtype)
IndexError: tuple index out of range
Am I doing something wrong?
Please advise! :)
you can run it with just the argument --matrixform added.
I suggest you to see this issue! from the github project it can help you

Is it really an error when I'm getting Traceback (most recent call last) without the word "error"?

What I get is this:
Traceback (most recent call last)
File "maian.py", line 24 in <module>
from web3 import web3
file "/usr/local/lib/python3.6/web3/__init__.py", line 5, in <module>
Correct me if I am wrong, but execution of program stops because the web3 thing (__init__.py) doesn't get loaded for some reason? How can I fix this?
What puzzles me again is that I'm not seeing a message at the very end telling me that something is wrong? I should now debug by trying to print some message...if it doesn't get printed then the program really stops while trying to initialize the web3 module?

Memory error in iGraph Python when adding large number of edges

Regarding this thread : http://goo.gl/uEyFua
I am experiencing a quite similar issue with the following code, trying to import a large Graph :
for (edge_id) in cursorSQL:
L.add((edge_id[2], str(edge_id[1])))
g = igraph.Graph.TupleList(L)
I get the following errors :
Traceback (most recent call last):
File "C.py", line 707, in __getitem__ return self._ids[item]
KeyError: '184840900'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
g = igraph.Graph.TupleList(L)
File "C:\Python34\lib\site-packages\igraph\__init__.py", line 2473, in TupleList
edge_list.append((idgen[item[0]], idgen[item[1]]))
File "C:\Python34\lib\site-packages\igraph\datatypes.py", line 709, in __getitem__
self._ids[item] = next(self._generator)
MemoryError
Just to make it clear. This code works perfectly until number of edges is too large (~4millions.)
Thanks.
Switched to python-64bits, and problem is now solved.
Problem was the 2GB-per-process limit in win7 for python-32bits.

Categories