equinor / dlisio

Python library for working with the well log formats Digital Log Interchange Standard (DLIS V1) and Log Information Standard (LIS79)
https://dlisio.readthedocs.io/en/latest/
Other
121 stars 39 forks source link

logical_file.data_format_specs() throwing AttributeError 'dlisio.core.lis_stream' object has no attribute 'read_records' #401

Closed AchyuthB closed 2 years ago

AchyuthB commented 2 years ago

Hi,

I upgraded the dlisio from version 0.3.4 to 0.3.5. Now I get error while calling "logical_file.data_format_specs()". It says AttributeError("'dlisio.core.lis_stream' object has no attribute 'read_records'")

image

It was working fine with version 0.3.4.

Any help is highly appreciated.

Thanks Achyuth

ErlendHaa commented 2 years ago

I'm unable to reproduce this. Can you provide a minimal code example + a full stack trace

AchyuthB commented 2 years ago

Hi @ErlendHaa, Thank you for your reply. Below is the code snippet. The code formatting is not working here, hence I am pasting it without formatting.

The exception is throwing at this line for format_specs in logical_file.data_format_specs():

from dlisio import lis

def read_lis_file( input_file_path ):
    try:
        try:
            physical_file = lis.load(input_file_path)
        except Exception as e:
            return

        for logical_file in physical_file:
            for format_specs in logical_file.data_format_specs():
                pass

    except Exception as e:
        print(" - Script Warn: While processing logical file - " + str(e))
    finally:
        physical_file.close()

if __name__ == "__main__":
    g_input_file = 'D:\FeedFiles\LIS\A\/164_07-_1_dwl_DWL_WIRE_1648905.lis'
    try:
        read_lis_file(g_input_file)
    except Exception as e:
        print(str(e))
    exit(0)
ErlendHaa commented 2 years ago

Hi,

I still can't reproduce. I'm unsure why it can't find read_records on lis_stream, it's clearly there [1]

https://github.com/equinor/dlisio/blob/48e3ef7fc6da173d695601708da79e1bb58b1c5a/python/dlisio/ext/lis.cpp#L668

Do you install dlisio trough pip? If so, have you tried installing a fresh instance in an isolated env?

AchyuthB commented 2 years ago

Hi,

Yes i installed dlisio using pip, actually i upgraded it with the below command.
pip install dlisio==0.3.5 image

May be the error is due to something specific in my environment. How do I test it isolated? Also, any other suggestions or recommendations which could get this resolved?

Should I try by uninstalling and re-installing the latest dlisio?

Thank you so much for your patience.

Regards, Achyuth

ErlendHaa commented 2 years ago

I would think so, yes. Try re-installing, maybe in a virtual env. I'm also curious about the -lisio warnings you get. lisio was an old working name for the lis-parser, but it never got introduced upstream. Did you checkout some old version of a dlisio fork or something?

AchyuthB commented 2 years ago

Hi @ErlendHaa,

I created a virtual environment and it worked as expected. Below are the steps i followed. Now have to figure out what is wrong with my environment.. :-(

I did not checkout any old version nor fork.

C:\>python -m venv D:\VirtualPython
D:\VirtualPython>D:\VirtualPython\Scripts\activate
(VirtualPython) D:\VirtualPython>py -m pip install dlisio

image

AchyuthB commented 2 years ago

Hi,

It is working now.

1. I uninstalled all the packages

pip freeze > requirements.txt
pip uninstall -r requirements.txt

2. Deleted these folders image

3. Then re-installed dlisio pip install dlisio

ErlendHaa commented 2 years ago

Great!