Skip to content

Python - update value of attributes #3

@bruniii

Description

@bruniii

Dear James,

first of all, thank you for this package and all the work required!

Using the python wrapper, I'm trying to read a sor file, update some of the fields, export again to a second sor file. For now, only simple string parameters in the object SupplierParametersBlock and GeneralParametersBlock.

import otdrs
sor = otdrs.parse_file('data/serravalle.sor')
sor.general_parameters.cable_id='Test01'

but for every attribute tested I'm getting the error:

AttributeError: attribute 'data' of 'otdrs.DataPointsAtScaleFactor' objects is not writable

Ideally, I would like to call your python module from LabVIEW to create from zero a .sor file (or, if needed, starting from a dummy .sor file and than update the relevant fields), using data acquired by the LabVIEW application. It's a convoluted way to make it but for now it's also the only one I can think about.

Since in the readme of the repo you wrote:

Editors are responsible for ensuring that any modification of data elsewhere in the file makes sense, e.g. if the number of points within a DataPointsAtScaleFactor struct is changed, then the n_points field must be amended by the editor; otdrs will not do this for you.

I expected to be able to at least change the parameters, if not the array of attenuation data. Am I wrong? Can you help me on this?

Thanks again,
Marco.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions