stratofax / xplat

Cross-platform Python tools for file management and conversion
MIT License
1 stars 3 forks source link

Names throws TypeError #3

Open stratofax opened 2 years ago

stratofax commented 2 years ago

Sample output:

➤ xplat names --source-dir ~/temp/ --dry-run
Scan 23.pdf
Scan 24.pdf
Scan 26.pdf
Total files found = 3
No output directory specified. Rename files? [y/N]: y
Selected files will be renamed and saved to:
/Users/neil/temp
Rename 3 files of type 'None'? [y/N]: y
Dry run is active, proposed changes won't be saved.
Proposing file name change from:
/Users/neil/temp/Scan 23.pdf
  to:
Traceback (most recent call last):
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/bin/xplat", line 5, in <module>
    app()
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/neil/Library/Caches/pypoetry/virtualenvs/xplat-gXevMVG1-py3.9/lib/python3.9/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/neil/repos/xplat/src/xplat/cli.py", line 189, in names
    rename_total = rename_list(file_list, output_dir, dryrun=dry_run)
  File "/Users/neil/repos/xplat/src/xplat/cli.py", line 78, in rename_list
    new_file_name = renamer.inet_names(f_name, output_dir, dryrun)
  File "/Users/neil/repos/xplat/src/xplat/renamer.py", line 34, in inet_names
    new_stem = new_stem.replace(" ", delim_chr)
TypeError: replace() argument 2 must be str, not bool
stratofax commented 2 years ago

Not resolved. Today's error:

➤ xplat names --source-dir ~/Dropbox/cadent/Projects/Erlene/text/convert/ --ext docx
POST #6.docx
Total files found = 1
No output directory specified. Rename files? [y/N]: y
Selected files will be renamed and saved to:
/home/neil/Dropbox/cadent/Projects/Erlene/text/convert
Rename 1 file of type 'docx'? [y/N]: y
Converting file name:
/home/neil/Dropbox/cadent/Projects/Erlene/text/convert/POST #6.docx
  to:
Traceback (most recent call last):
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/bin/xplat", line 5, in <module>
    app()
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/neil/.cache/pypoetry/virtualenvs/xplat-uC98EnBH-py3.10/lib/python3.10/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/home/neil/repos/xplat/src/xplat/cli.py", line 222, in names
    rename_total = rename_list(file_list, output_dir, dryrun=dry_run)
  File "/home/neil/repos/xplat/src/xplat/cli.py", line 79, in rename_list
    new_file_name = renamer.inet_names(f_name, output_dir, dryrun)
  File "/home/neil/repos/xplat/src/xplat/renamer.py", line 36, in inet_names
    new_stem = new_stem.replace(" ", delim_chr)
TypeError: replace() argument 2 must be str, not bool