Skip to content

IO.binwrite error perhaps due to missing pattern match on {:ok, data} return? #4

Description

@lasernite

When I run the basic usage like:

File.read("barcode.jpg") |> Zbar.scan()

I get an error like

** (FunctionClauseError) no function clause matching in IO.binwrite/2
    (elixir 1.10.4) lib/io.ex:275: IO.binwrite(#PID<0.628.0>, {:ok, <<255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 0, 0, 72, 0, 72, 0, 0, 255, 225, 0, 76, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 2, 1, 18, 0, 3, 0, 0, 0, 1, ...>>})
    (elixir 1.10.4) lib/file.ex:1417: File.open/3
    (elixir 1.10.4) lib/file.ex:1455: File.open!/3
    (zbar 0.2.1) lib/zbar.ex:38: Zbar.do_scan/2
    (elixir 1.10.4) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.10.4) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.13.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Looking through the recent commits and hypothesizing based on the binwrite error, perhaps the structure that needs to be passed to IO.binwrite should be (pid, symbols) instead of (pid, {:ok, symbols}) which is breaking the code in do_scan's return line 57 of zbar.ex?

Any thoughts appreciated! Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions