Closed bruniii closed 7 months ago
I did not debug it, but I think endpos - fh.tell()
generates a negative integer. I'll have a look.
Ok I fixed the problem by commenting out the line 44-45 in genparams.py
and 44-45 in supparams.py
tests are passing. this read was performed "in case" but we are seeking the file upside down during the process so can't see the point of doing this. Maybe you could check that values are ok for your fail.sor
file. If so I'll publish a new fixed version.
Thank you, I will try tomorrow morning and let you know!
Ottieni Outlook per Androidhttps://aka.ms/ghei36
From: Rémi Desgrange @.> Sent: Wednesday, February 21, 2024 7:45:54 PM To: sid5432/pyOTDR @.> Cc: bruniii @.>; Author @.> Subject: Re: [sid5432/pyOTDR] ValueError: read length must be non-negative or -1 (Issue #44)
Ok I fixed the problem by commenting out the line 44-45 in genparams.py and 44-45 in supparams.py tests are passing. this read was performed "in case" but we are seeking the file upside down during the process so can't see the point of doing this. Maybe you could check that values are ok for your fail.sor file. If so I'll publish a new fixed version.
— Reply to this email directly, view it on GitHubhttps://github.com/sid5432/pyOTDR/issues/44#issuecomment-1957678203, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEENDNFPUUVEA2USULKS4V3YUY6GFAVCNFSM6AAAAABDTJDDRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXGY3TQMRQGM. You are receiving this because you authored the thread.Message ID: @.***>
I can confirm that commenting the lines:
endpos = results["blocks"][bname]["pos"] + results["blocks"][bname]["size"]
fh.read(endpos - fh.tell())
in genparams.py
and supparams.py
fix the error and now the fail.sor
file can be read by your module.
Dear @RemiDesgrange, could you please realese a version with the fix? I tested locally commenting the two lines as suggested and finished the development of a small tool based on your module, but to give it to my collogues I'm waiting for the new official version of pyOTDR. Sorry to push for it, I'm already very thankful for your quick support!
Hi and thank you for this module!
When I try to read
.sor
files, sometimes the following script:return the error "ValueError: read length must be non-negative or -1" but only for some files, while for others the script complete, even if all of them are generated by the same OTDR instruments, the same day and, to my knowledge, with no meaningful differences.
I attach two examples, in a zip file: sor example.zip. I'm using python 3.12.1. The error:
The debug log from your package:
Could you please have a look at the sor files and help me?
Thank you!