carderne/signal-export

"unknown command sigexport"

junefish opened this issue · 5 comments

Desktop (please complete the following information):

  • OS and version: [e.g. Ubuntu 22.04, Windows 11, WSL 2] Mac OS 13
  • Terminal/shell used: [e.g. PowerShell, bash] fish

Describe the bug
sigexport is an unknown command

To reproduce
Steps to reproduce the behavior. Please include the exact commands tried.

  • download and install docker desktop (able to run the "getting started" example container fine)
  • python3 -m pip install signal-export
    • according to python3 -m pip show signal-export, installed to ~/Library/Python/3.9/lib/python/site-packages
  • sigexport --help
    • fish: Unknown command.   '~/Library/Python/3.9/lib/python/site-packages/sigexport' exists but is not an executable file.
    • ~/Library/Python/3.9/lib/python/site-packages/sigexport is a folder.

I tried pulling the image and running it with Docker Desktop, but then I get the error

Error: /Signal/config.json not found in directory /Signal
There doesn't seem to be a way to specify source filepath when running the container, but I am new to Docker so not sure what I'm missing.

On the fish Unknown command error

I don't know but I'd guess something specific to fish. But it seems like the exec script has either not had the executable bit set, or is a folder for some reason... You could try the following:

cat ~/Library/Python/3.9/lib/python/site-packages/sigexport

Should output some Python code like this:

import re
import sys
from sigexport.main import cli
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(cli())

Then/or try:

chmod +x ~/Library/Python/3.9/lib/python/site-packages/sigexport

Running directly with Docker:

If you run with Docker, you need to provide the full volume. eg --volume=/home/junefish/.config/Signal:/Signal.

Yeah, for some reason it's a folder:

$ cat ~/Library/Python/3.9/lib/python/site-packages/sigexport

cat: ~/Library/Python/3.9/lib/python/site-packages/sigexport: Is a directory

Not sure why, as I didn't do anything to manipulate the files after installing with pip, but I tried uninstalling and reinstalling:

$ python3 -m pip uninstall signal-export
Found existing installation: signal-export 1.3.0
Uninstalling signal-export-1.3.0:
  Would remove:
    ~/Library/Python/3.9/bin/sigexport
    ~/Library/Python/3.9/lib/python/site-packages/sigexport/*
    ~/Library/Python/3.9/lib/python/site-packages/signal_export-1.3.0.dist-info/*
Proceed (Y/n)? y
  Successfully uninstalled signal-export-1.3.0
  
  $ python3 -m pip install signal-export
Defaulting to user installation because normal site-packages is not writeable
Collecting signal-export
  Using cached signal_export-1.3.0-py3-none-any.whl (14 kB)
Requirement already satisfied: Markdown>=3.4.1 in ./Library/Python/3.9/lib/python/site-packages (from signal-export) (3.4.1)
Requirement already satisfied: beautifulsoup4>=4.11.1 in ./Library/Python/3.9/lib/python/site-packages (from signal-export) (4.11.1)
Requirement already satisfied: emoji>=1.7.0 in ./Library/Python/3.9/lib/python/site-packages (from signal-export) (2.2.0)
Requirement already satisfied: typer[all]>=0.7.0 in ./Library/Python/3.9/lib/python/site-packages (from signal-export) (0.7.0)
Requirement already satisfied: soupsieve>1.2 in ./Library/Python/3.9/lib/python/site-packages (from beautifulsoup4>=4.11.1->signal-export) (2.3.2.post1)
Requirement already satisfied: importlib-metadata>=4.4 in ./Library/Python/3.9/lib/python/site-packages (from Markdown>=3.4.1->signal-export) (5.0.0)
Requirement already satisfied: click<9.0.0,>=7.1.1 in ./Library/Python/3.9/lib/python/site-packages (from typer[all]>=0.7.0->signal-export) (8.1.3)
Requirement already satisfied: rich<13.0.0,>=10.11.0 in ./Library/Python/3.9/lib/python/site-packages (from typer[all]>=0.7.0->signal-export) (12.6.0)
Requirement already satisfied: shellingham<2.0.0,>=1.3.0 in ./Library/Python/3.9/lib/python/site-packages (from typer[all]>=0.7.0->signal-export) (1.5.0)
Requirement already satisfied: colorama<0.5.0,>=0.4.3 in ./Library/Python/3.9/lib/python/site-packages (from typer[all]>=0.7.0->signal-export) (0.4.6)
Requirement already satisfied: zipp>=0.5 in ./Library/Python/3.9/lib/python/site-packages (from importlib-metadata>=4.4->Markdown>=3.4.1->signal-export) (3.10.0)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in ./Library/Python/3.9/lib/python/site-packages (from rich<13.0.0,>=10.11.0->typer[all]>=0.7.0->signal-export) (0.9.1)
Requirement already satisfied: pygments<3.0.0,>=2.6.0 in ./Library/Python/3.9/lib/python/site-packages (from rich<13.0.0,>=10.11.0->typer[all]>=0.7.0->signal-export) (2.13.0)
Installing collected packages: signal-export
  WARNING: The script sigexport is installed in '~/Library/Python/3.9/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed signal-export-1.3.0

$ fish_add_path "~/Library/Python/3.9/bin"

Then I quit and reopened my terminal and sigexport --help worked. AFAICT this is the exact same steps I followed the first time, so no idea what went wrong, but that is resolved now.

Now, though, I am getting a failure with Docker:

$ sigexport ./Documents/signal_export
Using Docker to extract data, this may take a while the first time!
Docker process failed, see logs below:
Command '['docker', 'run', '--rm', '--volume=~/Library/Application Support/Signal:/Signal', 'carderne/sigexport:latest']' returned non-zero exit status 125.

I tried running with Docker, and the volume flag doesn't work:

$ docker run sigexport --volume=~/Library/Application Support/Signal:/Signal
Unable to find image 'sigexport:latest' locally
docker: Error response from daemon: pull access denied for sigexport, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

$ docker run carderne/sigexport:latest --volume=~/Library/Application Support/Signal:/Signal
Usage: sigexport [OPTIONS] [DEST]
Try 'sigexport --help' for help.
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ No such option: --volume (Possible options: --old, --source)

Hi @junefish, please install the latest version pip install -U signal-export and try again (sigexport output-dir), the docker issue you faced above should be fixed now by d0c70e3.

If you try to run directly with docker, please note that the --volume=/bla/bla:/Signal must come before the image name (carderne/sigexport:latest) and must be a full path (starting with / and no ~).

The upgrade fixed it!

$ sigexport ./Documents/signal_export
Using Docker to extract data, this may take a while the first time!
Copying and renaming attachments
Creating markdown files
Creating HTML files
Done!

Thanks very much for your help.