Giter Club home page Giter Club logo

Comments (4)

nbehrnd avatar nbehrnd commented on June 17, 2024

En route to extend the test script's scope (there is revised deposit in the pull request), the scene is more complex than anticipated earlier.

  • Xubuntu 20.04.2 LTS/Fossa, live image with addition of pytest for Python3 (Python 3.8.5, bash 5.0.17(1)): no problem to run appendfilename on any of the three test files 2022-01-07T18.48_test.txt, 2022-01-07_test.txt, or test.txt manually on the CLI, no problem to run all the automated tests. To select only those about --smart-prepend, either one of the two instructions below work well:
pytest-3 test_appendfilename.py -m "smart"
pytest-3 test_appendfilename.py -m "smart" -v  # a more verbose report to the CLI
  • Debian 12/bookworm, branch testing: Testing via test script (same instructions as for Xubuntu 20.04.2 LTS/Fossa) works without a problem. Only the direct.manual interaction on the CLI is inconsistent for either one of the two with date2name's default / --withtime time stamp. Perhaps the appendfilename's log when in the verbose mode helps to narrow the cause? If relevant, this session with Python 3.9.9 and bash 5.1.12.
norwid@carnot2:~/Desktop/test_debian$ appendfilename 2022-01-07_ping.txt --smart-prepend -t echo --verbose
DEBUG    2022-01-07 11:51:56,593 text found: [echo]
DEBUG    2022-01-07 11:51:56,593 extracting list of files ...
DEBUG    2022-01-07 11:51:56,593 len(args) [1]
DEBUG    2022-01-07 11:51:56,593 1 filenames found: [2022-01-07_ping.txt]
DEBUG    2022-01-07 11:51:56,593 iterate over files ...
DEBUG    2022-01-07 11:51:56,594 date/time-stamp found, insert text between date/time-stamp and rest
ERROR    2022-01-07 11:51:56,594 Error while trying to build new filename: <class 'TypeError'>
ERROR    2022-01-07 11:51:56,594 1 error(s) occurred. Please check output above.
norwid@carnot2:~/Desktop/test_debian$ ls
 2022-01-07_ping.txt   2022-01-07T11.48.38_ping.txt  'echo ping.txt'

from appendfilename.

novoid avatar novoid commented on June 17, 2024

Hi @nbehrnd,
Unfortunately, I can't reproduce the issue at my side and the debug output is not showing me something that helps me here.

I just committed a more verbose debug output for that use-case. For comparison, this is my output:

vk@sting ..lename/manualtests/2022-01-07-issue-13 (git)-[master] % appendfilename 2022-01-07_ping.txt --smart-prepend -t echo --verbose --dryrun
DEBUG    2022-01-07 17:04:35,268 text found: [echo]
DEBUG    2022-01-07 17:04:35,268 extracting list of files ...
DEBUG    2022-01-07 17:04:35,268 len(args) [1]
DEBUG    2022-01-07 17:04:35,268 1 filenames found: [2022-01-07_ping.txt]
DEBUG    2022-01-07 17:04:35,269 iterate over files ...
DEBUG    2022-01-07 17:04:35,269 options.smartprepend is set with ||echo| |2022-01-07_ping|.txt
DEBUG    2022-01-07 17:04:35,269 options.smartprepend is set with |<class 'str'>|<class 'str'>|<class 'str'>|<class 'str'>|<class 'str'>
DEBUG    2022-01-07 17:04:35,269 date/time-stamp found, insert text between date/time-stamp and rest
DEBUG    2022-01-07 17:10:30,808 options.smartprepend is set with ||2022-01-07|ping.txt|
DEBUG    2022-01-07 17:10:30,808 options.smartprepend is set with |<class 'str'>|<class 'str'>|<class 'str'>|
DEBUG    2022-01-07 17:10:30,808 new_filename is now: 2022-01-07 echo ping.txt
INFO     2022-01-07 17:04:35,269  
INFO     2022-01-07 17:04:35,269  renaming "2022-01-07_ping.txt"
INFO     2022-01-07 17:04:35,269       ⤷   "2022-01-07 echo ping.txt"
DEBUG    2022-01-07 17:04:35,269 successfully finished.
Please press <Enter> for finishing...
vk@sting ..lename/manualtests/2022-01-07-issue-13 (git)-[master] %

Can you please re-run your test and post here the output? Thank you very much!

from appendfilename.

nbehrnd avatar nbehrnd commented on June 17, 2024

By observation, now the manual conversion works (both on Xubuntu 20.04.2 LTS Fossa, as well as on Debian 12/book worm [testing]). Conceptually, the extended log to the CLI matches yours:

norwid@carnot2:~/Desktop/2022-01-07T18.51.32_appendfilename/appendfilename/appendfilename$ python __init__.py 2022-01-07_ping.txt --smart-prepend -t echo --verbose --dryrun
DEBUG    2022-01-07 19:12:09,498 text found: [echo]
DEBUG    2022-01-07 19:12:09,498 extracting list of files ...
DEBUG    2022-01-07 19:12:09,499 len(args) [1]
DEBUG    2022-01-07 19:12:09,499 1 filenames found: [2022-01-07_ping.txt]
DEBUG    2022-01-07 19:12:09,499 iterate over files ...
DEBUG    2022-01-07 19:12:09,499 options.smartprepend is set with ||echo| |2022-01-07_ping|.txt
DEBUG    2022-01-07 19:12:09,499 options.smartprepend is set with |<class 'str'>|<class 'str'>|<class 'str'>|<class 'str'>|<class 'str'>
DEBUG    2022-01-07 19:12:09,499 date/time-stamp found, insert text between date/time-stamp and rest
DEBUG    2022-01-07 19:12:09,499 options.smartprepend is set with ||2022-01-07|ping.txt|
DEBUG    2022-01-07 19:12:09,499 options.smartprepend is set with |<class 'str'>|<class 'str'>|<class 'str'>|
DEBUG    2022-01-07 19:12:09,499 new_filename is now: 2022-01-07 echo ping.txt
INFO     2022-01-07 19:12:09,499  
INFO     2022-01-07 19:12:09,499  renaming "2022-01-07_ping.txt"
INFO     2022-01-07 19:12:09,499       ⤷   "2022-01-07 echo ping.txt"
DEBUG    2022-01-07 19:12:09,500 successfully finished.
Please press <Enter> for finishing...
norwid@carnot2:~/Desktop/2022-01-07T18.51.32_appendfilename/appendfilename/appendfilename$ 

So, this obstacle is out of the way. Thank you!

from appendfilename.

novoid avatar novoid commented on June 17, 2024

Weird.

Well, thanks for your effort in any case. Let me know when this reappears. I keep the additional debug code for now.

from appendfilename.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.