Closed CliveMcCarthy closed 11 months ago
Python 3.8.10 Linux Kernel 5.15 Mint 20.3
Traceback (most recent call last):
File "/home/clive/.local/bin/rembg", line 8, in
@CliveMcCarthy hello, could you please share here the command you are trying to run?
The command line is nothing special. I shall try to reproduce it. I have moved on and am now using a Python script that calls rembg directly and that works just fine. My command line was: rembg i audrey.jpg audrey.png
It still shows the same problem.
Incidentally, I tried the u2net_human_seg in place of u2net and got poorer results. Odd.
*I have the same issue:
Command: rembg i image.jpg transparent_output.png
After writing my own very small Python script to run rembg my guess is that there is some misuse of the command line interpreter library function. I did a web search and saw something about a bug/change in CLI -- which I assume is the command line interpreter.
Same encountered the issue:
ubuntu@<TAPH>:~/rembg$ rembg i input/sample-car.jpeg output/nobg-car-png
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python3.8/site-packages/rembg/cli.py", line 33, in main
_main()
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1135, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 641, in make_context
self.parse_args(ctx, args)
File "/usr/lib/python3/dist-packages/click/core.py", line 940, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/usr/lib/python3/dist-packages/click/core.py", line 1469, in handle_parse_result
value = self.full_process_value(ctx, value)
File "/usr/lib/python3/dist-packages/click/core.py", line 1790, in full_process_value
return Parameter.full_process_value(self, ctx, value)
File "/usr/lib/python3/dist-packages/click/core.py", line 1441, in full_process_value
value = self.get_default(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1745, in get_default
return Parameter.get_default(self, ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1385, in get_default
return self.type_cast_value(ctx, rv)
File "/usr/lib/python3/dist-packages/click/core.py", line 1411, in type_cast_value
return self.type(value or (), self, ctx)
File "/usr/lib/python3/dist-packages/click/types.py", line 39, in __call__
return self.convert(value, param, ctx)
File "/usr/lib/python3/dist-packages/click/types.py", line 590, in convert
raise TypeError('It would appear that nargs is set to conflict '
TypeError: It would appear that nargs is set to conflict with the composite type arity.
Temporary hack: comment lines below in /path/to/python/dist-packages/rembg/commands/i_command.py
:
@click.option(
"-bgc",
"--bgcolor",
default=None,
type=(int, int, int, int),
nargs=4,
help="Background color (R G B A) to replace the removed background with",
)
I think problem is in using nargs with tuple type
facing the same problem! the fix works for me but the fix doesn't work when input and output are folders... i get another error after this then...
This issue is stale because it has been open for 30 days with no activity.
same error here: TypeError: It would appear that nargs is set to conflict with the composite type arity.
command was rembg i input.png output.png
where input.png exists
I got this error while trying
rembg i /home/myPC/12.png /home/myPC/haa.png
using Ubuntu 22.04
Temporary hack: comment lines below in
/path/to/python/dist-packages/rembg/commands/i_command.py
:@click.option( "-bgc", "--bgcolor", default=None, type=(int, int, int, int), nargs=4, help="Background color (R G B A) to replace the removed background with", )
I think problem is in using nargs with tuple type
This trick works. Thanks
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Not fixed
I'm no Python programmer but I get this:
File "/usr/lib/python3/dist-packages/click/types.py", line 590, in convert raise TypeError('It would appear that nargs is set to conflict ' TypeError: It would appear that nargs is set to conflict with the composite type arity.
It looks like the CLI code has a bug