Python Forum
Executing a command which fails
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Executing a command which fails
#1
Hi,

Running the command
gphoto2 --force-overwrite --get-all-files
using 2 options works. However, when I run it via script it fails with the message below.

I appreciated some indications.
TIA

from sh import gphoto2 as gp
downloadCommand = ["--force-overwrite --get-all-files"]
gp(downloadCommand)
Quote:Traceback (most recent call last):
File "imageCapture.py", line 65, in <module>
captureImages()
File "imageCapture.py", line 48, in captureImages
gp(downloadCommand)
File "/usr/local/lib/python3.7/dist-packages/sh.py", line 1549, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/local/lib/python3.7/dist-packages/sh.py", line 793, in __init__
self.wait()
File "/usr/local/lib/python3.7/dist-packages/sh.py", line 849, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.7/dist-packages/sh.py", line 877, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: /usr/bin/gphoto2 '--force-overwrite --get-all-files'

STDOUT:


STDERR:
Usage: gphoto2 [-?qvalLnPTDR] [-?|--help] [--usage] [--debug]
[--debug-loglevel=STRING] [--debug-logfile=FILENAME] [-q|--quiet]
[--hook-script=FILENAME] [--stdout] [--stdout-size] [--auto-detect]
[--show-exif=STRING] [--show-info=STRING] [--summary] [--manual]
[--about] [--storage-info] [--shell] [-v|--version]
[--list-cameras] [--list-ports] [-a|--abilities] [--port=FILENAME]
[--speed=SPEED] [--camera=MODEL] [--usbid=USBIDs] [--config]
[--list-config] [--list-all-config] [--get-config=STRING]
[--set-config=STRING] [--set-config-index=STRING]
[--set-config-value=STRING] [--reset] [--keep] [--keep-raw]
[--no-keep] [--wait-event=COUNT, SECONDS, MILLISECONDS or MAT... (1077 more, please see e.stderr)

EDIT:
Fixed it by adding a comma between the two commands.
downloadCommand = ["--force-overwrite"],["--get-all-files"]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to parallel executing a command using subprocess? larkypython 0 2,101 Nov-28-2019, 03:49 PM
Last Post: larkypython
  Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2 Newtopython123 10 31,162 Apr-25-2019, 07:30 AM
Last Post: banu0395

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020