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

libpostal_setup() only works once #6

Closed
boshkins opened this issue Sep 28, 2015 · 2 comments
Closed

libpostal_setup() only works once #6

boshkins opened this issue Sep 28, 2015 · 2 comments

Comments

@boshkins
Copy link

Al,

libpostal_setup() only works once, all subsequent calls fail, regardless of calls to libpostal_teardown() in between, the error message is:

ERR   Error loading transliteration module
   at libpostal_setup (libpostal.c:742) errno: No such file or directory

I guess a given app is not likely to call setup/teardown more than once per run, so this is not a big deal. My context is a test suite that tries to separate test cases cleanly, thus multiple setup/teardown call pairs.

Thank you,
Anatoly

@albarrentine
Copy link
Contributor

Fixed with 12816d0

In general libpostal_setup/libpostal_teardown are relatively expensive calls as they load models from disk and are only supposed to run once per application (e.g. in a dynamic language like Python these would run at module import time).

Unless you're testing whether libpostal's setup works (though they're not currently on Github, libpostal has its own tests which can do that), I wouldn't recommend more than one call to setup and one call to teardown in the entire program.

Also note: libpostal is not thread-safe, so if the tests are threaded it might be problematic.

@boshkins
Copy link
Author

Understood, thank you.
My testing is purely exploratory; double calls to setup() were an artifact
of the test framework I use (Catch). Would be very interested to see your
test suite!

On Mon, Sep 28, 2015 at 5:44 PM, Al Barrentine notifications@github.com
wrote:

Closed #6 #6.


Reply to this email directly or view it on GitHub
#6 (comment).

Anatoly "Tolya" Boshkin
Boshkins Software Corporation
email: anatoly@boshkins.com
Skype:anatoly.boshkin
mob phone: (703) 472 0184

oskar700 pushed a commit that referenced this issue Jan 8, 2024
TerranceNHanlon pushed a commit to roadie-app/libpostal that referenced this issue May 14, 2024
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

2 participants