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

Python code fails on accessing filecontent data #293

Open
andrej1919 opened this issue Aug 6, 2023 · 0 comments
Open

Python code fails on accessing filecontent data #293

andrej1919 opened this issue Aug 6, 2023 · 0 comments
Labels

Comments

@andrej1919
Copy link

andrej1919 commented Aug 6, 2023

Describe the bug
A clear and concise description of what the bug is.
Organize returns an error: (python) ERROR! 'dict' object has no attribute 'dateslo'. The same Python code works just fine if I use a fake variable like date_var = '5. 6. 2023' and use date_var instead of filecontent.dateslo, which reads the date from the PDF.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS:
    Operating System: Manjaro Linux
    KDE Plasma Version: 5.27.6
    KDE Frameworks Version: 5.108.0
    Qt Version: 5.15.10
    Kernel Version: 6.4.6-1-MANJARO (64-bit)
    Graphics Platform: X11
  • Output of organize --version:
    organize, version 2.4.0

Your config file

  - name: "testing"
    locations:
      - ~/Downloads 
    subfolders: false
    filters:
      - extension: pdf
      - filecontent: 'Some company name'
      - filecontent: 'Some code: 4999BFV3P22OW90'
      - filecontent: 'Statement on a date (?P<date_slo>\d{1,2}\. \s*\d{1,2}\. \s*\d{4})'
      - python: |
          import datetime
          date_result=datetime.datetime.strptime(filecontent.date_slo, "%d. %m. %Y").strftime("%Y-%m-%d")
          return {"parsed_date": date_result}
      - lastmodified  
    actions:
      - echo: "statement on {python.parsed_date}" 
@andrej1919 andrej1919 added the bug label Aug 6, 2023
@tfeldmann tfeldmann changed the title Python code fails on accesing filecontent data Python code fails on accessing filecontent data Jan 7, 2024
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

1 participant