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

[BUG] Consecutive comment lines in loadtxt #706

Open
Bzero opened this issue Jan 25, 2025 · 1 comment
Open

[BUG] Consecutive comment lines in loadtxt #706

Bzero opened this issue Jan 25, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Bzero
Copy link

Bzero commented Jan 25, 2025

Describe the bug
loadtxt raises a ValueError if the data file contains two consecutive comment lines.

ulab version: 6.7.2-2D

To Reproduce
Create a data file with the following content:

# A multi-line
# comment
0 1
2 3

And try to load it with loadtxt:

from ulab import numpy
print(numpy.loadtxt('data.dat'))

Results in a ValueError:

Traceback (most recent call last):
  File "code.py", line 2, in <module>
ValueError: invalid syntax for number

Expected behavior
Load the data in an array:

array([[0.0, 1.0],
       [2.0, 3.0]], dtype=float32)

Additional context
If the second comment line starts with a whitespace the error does not occur:

# A multi-line
 # comment
0 1
2 3
@Bzero Bzero added the bug Something isn't working label Jan 25, 2025
@v923z
Copy link
Owner

v923z commented Jan 26, 2025

Thanks for the report, I'll try to sort it out.

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

2 participants