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

Example run error #2

Open
adamwawrzynski opened this issue Oct 13, 2020 · 2 comments
Open

Example run error #2

adamwawrzynski opened this issue Oct 13, 2020 · 2 comments

Comments

@adamwawrzynski
Copy link

I am using docker container to install all dependencies. It looks as follows:

FROM ubuntu:latest

WORKDIR /app

RUN apt-get update -y \
    && apt-get install -y \
    git \
    make \ 
    cython \
    wget \
    automake \
    build-essential \
    python3-dev \
    python3-pip \
    zlib1g-dev

RUN python3 -m pip install \
    cython \
    requests

RUN git clone https://github.com/NixOS/patchelf
WORKDIR /app/patchelf
RUN ./bootstrap.sh \
    && ./configure \
    && make \
    && make check \
    && make install
WORKDIR /app/

RUN git clone https://github.com/jpuigcerver/openfst-python
WORKDIR /app/openfst-python
RUN python3 setup.py install

WORKDIR /app/

After executing example code from README:

import openfst_python as fst

f = fst.Fst()
s0 = f.add_state()
s1 = f.add_state()
s2 = f.add_state()
f.add_arc(s0, fst.Arc(1, 2, fst.Weight(f.weight_type(), 3.0), s1))
f.add_arc(s0, fst.Arc(1, 3, fst.Weight.One(f.weight_type()), s2))
f.add_arc(s1, fst.Arc(2, 1, fst.Weight(f.weight_type(), 1.0), s2))
f.set_start(s0)
f.set_final(s2, fst.Weight(f.weight_type(), 1.5))
print(f)

And I got following error:

Traceback (most recent call last):
  File "fsa.py", line 32, in <module>
    f = fst.Fst()
  File "pywrapfst.pyx", line 1617, in pywrapfst.Fst.__init__
AttributeError: 'pywrapfst.Fst' object has no attribute '_class__'
@adamjankaczmarek
Copy link

adamjankaczmarek commented Oct 13, 2020

There seem to be two separate issues:

  • typo in OpenFst's pywrapfst (namely _class__ instead of __class__)
  • outdated example (incompatible from openfst 1.7.6)

@jpuigcerver
Copy link
Owner

Hi Adam,

Yes. The Python interface for OpenFst has been broken at least since version 1.7.1. Last time I checked, 1.7.9 was still broken. This library uses wraps that interface, so until they fix it, there's not much I can do.

You can switch to the 1.6.9 branch and that should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants