Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include multiple actions and mix move and shell crashes organize-tool #372

Closed
hum4nizer opened this issue Mar 22, 2024 · 3 comments
Closed
Labels

Comments

@hum4nizer
Copy link

Describe the bug
Include multiple actions in rule and mix the actions "move" and "shell" crashes organize-tool

Screenshots
raceback (most recent call last):
File "/usr/lib/python3.11/site-packages/organize/rule.py", line 288, in execute
for action in action_pipeline(
File "/usr/lib/python3.11/site-packages/organize/rule.py", line 101, in action_pipeline
action.pipeline(res=res, simulate=simulate, output=output)
File "/usr/lib/python3.11/site-packages/organize/actions/shell.py", line 55, in pipeline
full_cmd = render(self._cmd, res.dict())
^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/organize/resource.py", line 54, in dict
relative_path=self.relative_path(),
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/organize/resource.py", line 47, in relative_path
return self.path.relative_to(self.basedir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/pathlib.py", line 730, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: FILEPATH FILENAME is not in the subpath of FILEPATH OR one path is relative and the other is absolute.
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/organize", line 8, in
sys.exit(cli())
^^^^^
File "/usr/lib/python3.11/site-packages/organize/cli.py", line 286, in cli
_execute(simulate=False)
File "/usr/lib/python3.11/site-packages/organize/cli.py", line 146, in execute
).execute(
^^^^^^^^
File "/usr/lib/python3.11/site-packages/organize/config.py", line 105, in execute
rule_summary = rule.execute(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/organize/rule.py", line 298, in execute
output.msg(
File "/usr/lib/python3.11/site-packages/organize/output/default.py", line 175, in msg
self.show_resource(res)
File "/usr/lib/python3.11/site-packages/organize/output/default.py", line 123, in show_resource
relative_path = res.relative_path()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/organize/resource.py", line 47, in relative_path
return self.path.relative_to(self.basedir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Environment (please complete the following information):

  • OS: Linux Alpine 3.19.1
  • Output of organize --version: organize v3.2.2

Your config file

rules:
  - locations: /mnt/storage01/files/finished/
    subfolders: True
    filters:
      - extension: 
        - .pdf
        - .docx
      - name:
          startswith:
            - Project
          contains:
            - Enigma
          case_sensitive: False
    actions:
      - move: '/mnt/storage01/Projects/Project Enigma/'
      - shell: 'logwriter logfile=/var/log/project.log message="Moved file {path.stem} to project directory"'
   
@hum4nizer hum4nizer added the bug label Mar 22, 2024
@tfeldmann
Copy link
Owner

Thank you for reporting!

tfeldmann added a commit that referenced this issue Mar 29, 2024
@tfeldmann
Copy link
Owner

This is fixed in the new version.

@hum4nizer
Copy link
Author

Thank you so much for a wonderful project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants