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

'shutil' is not defined #1105

Open
1 of 2 tasks
PacoBell opened this issue Mar 30, 2024 · 4 comments
Open
1 of 2 tasks

'shutil' is not defined #1105

PacoBell opened this issue Mar 30, 2024 · 4 comments
Assignees
Labels
Bug / Error Something isn't working

Comments

@PacoBell
Copy link

Duplicate Issues

  • There are no existing posts relating to my problem
  • There are existing posts relating to my problem, but the solution given, doesn't work for me.

What happened?

YT-Spammer-Purge-2.18.0-Beta3
Termux on Android 14

File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/logging.py", line 769, in add_sample consoleWidth = utils.get_terminal_size() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/utils.py", line 177, in get_terminal_size return shutil.get_terminal_size().columns ^^^^^^ NameError: name 'shutil' is not defined

You need to "import shutil" somewhere. That is all.

Release version

2.18.0-Beta3

Steps to reproduce

  1. Run YTSP
  2. Press Enter to display comments
  3. Sadness

What platform are you seeing this problem on?

Linux (can also be ChromeOS)

Relevant log output

Traceback (most recent call last):
  File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/YTSpammerPurge.py", line 1721, in <module>
    main()
  File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/YTSpammerPurge.py", line 1698, in main      continueRunning = primaryInstance(miscData)                               ^^^^^^^^^^^^^^^^^^^^^^^^^           File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/YTSpammerPurge.py", line 1333, in primaryInstance                                                   logFileContents, logMode = logging.print_comments(current, config, scanVideoID, loggingEnabled, scanMode, logMode)                                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                    File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/logging.py", line 28, in print_comments                                                     j, commentsContents = print_prepared_comments(current, commentsContents, scanVideoID, list(current.matchedCommentsDict.keys()), j, loggingEnabled, scanMode, logMode, doWritePrint, matchReason="Filter Match")                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^               File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/logging.py", line 332, in print_prepared_comments                                           add_sample(current, author_id_local, author, text, matchReason, matchedText, longestAuthorNameLength)         File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/logging.py", line 769, in add_sample                                                        consoleWidth = utils.get_terminal_size()                               ^^^^^^^^^^^^^^^^^^^^^^^^^              File "/storage/emulated/0/Download/YTSP/YT-Spammer-Purge-2.18.0-Beta3/Scripts/utils.py", line 177, in get_terminal_size                                                   return shutil.get_terminal_size().columns                      ^^^^^^                                       NameError: name 'shutil' is not defined                 ------------------------------------------------

Screenshots

No response

@PacoBell PacoBell added the Bug / Error Something isn't working label Mar 30, 2024
@Firecul
Copy link
Contributor

Firecul commented Mar 30, 2024

It's a windows api according to here not really something easily imported on android.
Of course, I don't know code so I could be wrong

@PacoBell
Copy link
Author

PacoBell commented Mar 30, 2024

Naw, man, it's just part of Python. I literally just added the import one-liner to utils.py and it worked.

Sauce: https://docs.python.org/3/library/shutil.html

@Firecul
Copy link
Contributor

Firecul commented Apr 2, 2024

Naw, man, it's just part of Python. I literally just added the import one-liner to utils.py and it worked.

Fair enough

virophagesp added a commit to virophagesp/YT-Spammer-Purge that referenced this issue May 5, 2024
added import for shutil
@therealOri
Copy link

therealOri commented Jul 27, 2024

To add onto this, logging.py and utils.py are the 2 files where shutil isn't imported but need to be imported.

Platform: Arch Linux (cachyOS)
Python version: 3.12.4
Release: YT-Spammer-Purge-2.18.0-Beta3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug / Error Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants