Skip to content

(Protocol.UndefinedError) protocol Enumerable #15

@danieldocki

Description

@danieldocki

This code

  def transform(source, target, :thumb) do
    Bow.Exec.exec source, target,
      "convert ${input} -strip -gravity Center -resize 250x175^ -extent 250x175 ${output}"
  end

produces this error

{:error,
 %{
   original: :ok,
   thumb: {:error,
    %Protocol.UndefinedError{
      description: "",
      protocol: Enumerable,
      value: "convert ${input} -strip -gravity Center -resize 250x175^ -extent 250x175 ${output}"
    }}
 }}

I think is this part about put info about input and output of command

https://github.com/Recruitee/bow/blob/master/lib/bow/exec.ex#L43-L45

    cmd =
      command
      |> Enum.map(fn

If I try

command = "convert ${input} -strip -gravity Center -resize 250x175^ -extent 250x175 ${output}"
cmd = command |> Enum.map(fn x -> x end)

return

** (Protocol.UndefinedError) protocol Enumerable not implemented for "convert ${input} -strip -gravity Center -resize 250x175^ -extent 250x175 ${output}" of type BitString. This protocol is implemented for the following type(s): Ecto.Adapters.SQL.Stream, Postgrex.Stream, DBConnection.Stream, DBConnection.PrepareStream, HashSet, Range, Map, Function, List, Stream, Date.Range, HashDict, GenEvent.Stream, MapSet, File.Stream, IO.Stream
    (elixir 1.10.1) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.10.1) lib/enum.ex:141: Enumerable.reduce/3
    (elixir 1.10.1) lib/enum.ex:3383: Enum.map/2

I think the purpose of this code snippet is to have the final command to process the conversion, so I tried to map the input and output to put the information, but I was not successful 😞

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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