Repository navigation
Add FixedWidthTwoLine Reader to guess list - #3109
Conversation
|
A lot of the tests appear to be erroring, so I think this will need another pass. |
|
@taldcroft It now passes locally for me, let's see what Travis says. In my opinion, the most tricky test is in this file: https://github.com/astropy/astropy/blob/master/docs/io/ascii/index.rst The problem here is that the second line contains three characters ( Alternatively, I could role back two commits and fix the second line in this example to |
|
@taldcroft All the failures are in python 3. I've not used python 3 yet, do you see where the problem is? |
|
@hamogu - nothing jumping out at me. You probably need to install Py3 and play with it. Fortunately this is pretty trivial with anaconda. |
|
I think the issue is that when guessing, all actual exceptions are silenced so it makes it harder to debug. |
|
The problem with the Py3 failures stems from cases where a file object is passed in, and is related to get_readable_fileobj. In Py3 if the first guess fails then the file object ends up being closed [EDIT: not just the output of After the first failed guess Maybe if guessing is enabled and a file object is passed, that it should just be read at a high level (in |
|
That makes sense. The test failures are all cases where the table would be read by the first element in the guessing before this patch. So, in the process of implementing this we have uncovered a bug different from what I set out to do originally. I think it would be best if we found a quick workaround, not necessarily an in-depth fix. |
|
After tinkering with the code for a few hours, I still don't understand why calling the context manager a second time closes the file: |
|
This might be related to #3013? |
|
The problem here should be fixed by #3132. |
As discussed in astropy#3025 and astropy#3099, it would be useful if tables that are copied from the screen (where the defaul print format is something like) ``` col1 col2 ---- ---- 1.0 2.0 3.0 44.0 ``` into a file could be read automatically with the guessing process. closes astropy#3099 closes astropy#3025
|
I pushed the rebased version so I can see if Travis likes it. |
|
@taldcroft : Travis passed. |
Add FixedWidthTwoLine Reader to guess list
As discussed in #3025 and #3099, it would be useful if tables that are copied
from the screen (where the default print format is something like)
into a file could be read automatically with the guessing process.
CC: @taldcroft @demitri @embray
I did not measure the performance, but with this we will surely have a performance hit since this adds a
FixedWidthTwoLineReader to the top of the guessing list. This Reader does not have a fast c implementation and it will read only a small fraction of the tables. My impression is that most tables will be read with theBasicReader. If that is true, then we will increase the average read time with guessing by a factor of two. However, since the tables in question would also be read byBasicbut not in the way we want (string entries like----in the first row) there is no way around tryingFixedWidthTwoLinefirst.closes #3099
closes #3025