Problem passing string value as docid · Issue #26 · proycon/python-frog · GitHub
Skip to content

Problem passing string value as docid #26

Closed

Description

@oktaal

When creating a Frog instance such as:

from frog import Frog, FrogOptions
frog_instance = Frog(FrogOptions(
    xmlout=True,
    docid='DOCID',
    mwu=False,
    parser=False
))

I get the following error:

  File "frog_wrapper.pyx", line 80, in frog.FrogOptions.__init__
  File "frog_wrapper.pyx", line 125, in frog.FrogOptions.__setitem__
  File "<stringsource>", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found

When I add an encode() to docid='DOCID' it works:

from frog import Frog, FrogOptions
frog_instance = Frog(FrogOptions(
    xmlout=True,
    docid='DOCID'.encode(),
    mwu=False,
    parser=False
))

Reading:

I think it might need this for id and threads as well, such as it already does for skip, and/or it might need to check if the value has already been encoded to bytes.

Activity

  1. proycon commented on Nov 20, 2023

    @proycon
    Owner

    Thanks, good point indeed! I'll adapt it so it's more intuitive and you can pass strings.

  2. self-assigned this
    on Nov 20, 2023
  3. proycon commented on Nov 24, 2023

    @proycon
    Owner

    Fixed in v0.6.9 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions