Python Forum
Any suggestions for improvement?(my first python code) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: Code sharing (https://python-forum.io/forum-5.html)
+--- Thread: Any suggestions for improvement?(my first python code) (/thread-12688.html)



Any suggestions for improvement?(my first python code) - PyAlex - Sep-07-2018

I wrote this code to transfer all the video files from the download folder to the usb.

import threading
from threading import Thread
import os, shutil, time

#patch from https://stackoverflow.com/questions/21799210/python-copy-larger-file-too-slow
def _copyfileobj_patched(fsrc, fdst, length=16*1024*1024):
    """Patches shutil method to hugely improve copy speed"""
    while 1:
        buf = fsrc.read(length)
        if not buf:
            break
        fdst.write(buf)
shutil.copyfileobj = _copyfileobj_patched
#patch from https://stackoverflow.com/questions/21799210/python-copy-larger-file-too-slow

download = "C:\\Users\\AC Milan\\Downloads\\"
USB = "G:\\"
video_format = (".3gp",".asf",".avi",".divx",".flv",".swf",".mp4",".mpeg",".mpg",".ogm",".wmv",".mov",".mkv",".nbr",".rm",".vob",".sfd",".webm",".xvid")
current_file = ""
current_file_size = 0

def move_file():
    global current_file
    global current_file_size
    os.chdir(download)
    for dirs, s_dirs, files in os.walk(download):
        for file in files:
            for v_format in video_format:
                if v_format in file:
                    os.chdir(str(dirs))
                    current_file = file
                    current_file_size = os.stat(file).st_size
                    shutil.copy(file,USB)
                    current_file = ""
                    print(f"►File [[ {file} ]] transfered                                                            ")
    print("All files transfered")
                    
def get_file_size(folder):
    os.chdir(folder)
    file_size = 0
    for dirs, s_dirs, files in os.walk(folder):
        for file in files:
            for v_format in video_format:
                if v_format in file:
                    os.chdir(str(dirs))
                    file_size += os.stat(file).st_size
    return file_size

    
def perc():
    file_size = get_file_size(download)
    moved_size = get_file_size(USB)
    return int(moved_size/file_size*100)

def print_perc():
    while True:
        perce = perc()
        current_transfered_size = os.stat(f"{str(USB)}{current_file}").st_size
        current_perc = int(current_transfered_size/current_file_size*100)
        print(f"|{'▒'*int(perce/2)}{' '*(50-int(perce/2))}| {perce}%    {current_file[:20]} {current_perc}%",end="\r")
        time.sleep(0.1)
        
if __name__ == '__main__':
    Thread(target = move_file).start()
    Thread(target = print_perc).start()



RE: Any suggestions for improvement?(my first python code) - Larz60+ - Sep-07-2018

the following are pycodestyle (which checks for PEP8 compatibility) generated issues.
Code can run perfectly well without being compliant, but you should strive to get there.
Output:
PyAlex.py:3:10: E401 multiple imports on one line PyAlex.py:4:1: W293 blank line contains whitespace PyAlex.py:5:1: E265 block comment should start with '# ' PyAlex.py:5:80: E501 line too long (89 > 79 characters) PyAlex.py:6:1: E302 expected 2 blank lines, found 1 PyAlex.py:13:1: E305 expected 2 blank lines after class or function definition, found 0PyAlex.py:14:1: E265 block comment should start with '# ' PyAlex.py:14:80: E501 line too long (89 > 79 characters) PyAlex.py:15:1: W293 blank line contains whitespace PyAlex.py:18:23: E231 missing whitespace after ',' PyAlex.py:18:30: E231 missing whitespace after ',' PyAlex.py:18:37: E231 missing whitespace after ',' PyAlex.py:18:45: E231 missing whitespace after ',' PyAlex.py:18:52: E231 missing whitespace after ',' PyAlex.py:18:59: E231 missing whitespace after ',' PyAlex.py:18:66: E231 missing whitespace after ',' PyAlex.py:18:74: E231 missing whitespace after ',' PyAlex.py:18:80: E501 line too long (152 > 79 characters) PyAlex.py:18:81: E231 missing whitespace after ',' PyAlex.py:18:88: E231 missing whitespace after ',' PyAlex.py:18:95: E231 missing whitespace after ',' PyAlex.py:18:102: E231 missing whitespace after ',' PyAlex.py:18:109: E231 missing whitespace after ',' PyAlex.py:18:116: E231 missing whitespace after ',' PyAlex.py:18:122: E231 missing whitespace after ',' PyAlex.py:18:129: E231 missing whitespace after ',' PyAlex.py:18:136: E231 missing whitespace after ',' PyAlex.py:18:144: E231 missing whitespace after ',' PyAlex.py:21:1: W293 blank line contains whitespace PyAlex.py:22:1: E302 expected 2 blank lines, found 1 PyAlex.py:33:37: E231 missing whitespace after ',' PyAlex.py:35:80: E501 line too long (119 > 79 characters) PyAlex.py:37:1: W293 blank line contains whitespace PyAlex.py:38:1: E302 expected 2 blank lines, found 1 PyAlex.py:48:1: W293 blank line contains whitespace PyAlex.py:49:1: W293 blank line contains whitespace PyAlex.py:54:1: W293 blank line contains whitespace PyAlex.py:55:1: E302 expected 2 blank lines, found 1 PyAlex.py:60:80: E501 line too long (118 > 79 characters) PyAlex.py:60:109: E231 missing whitespace after ',' PyAlex.py:62:1: W293 blank line contains whitespace PyAlex.py:63:1: E305 expected 2 blank lines after class or function definition, found 1 PyAlex.py:64:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:64:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:40: W292 no newline at end of file
The following are pylint (only 2!) comments:
Output:
{ "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 26, "startColumn": 15, "endLineNumber": 26, "endColumn": 15 { "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 41, "startColumn": 15, "endLineNumber": 41, "endColumn": 15 } }



RE: Any suggestions for improvement?(my first python code) - Mekire - Sep-07-2018

One thing that jumps out is you don't need to interate through the file extensions.
You can store the file extension list as a set and use os.path.splitext to find the current file's extenstion.

Example:
import os


video_format = {
    ".3gp",".asf",".avi",".divx",".flv",".swf",".mp4",".mpeg", ".mpg",
    ".ogm",".wmv",".mov",".mkv",".nbr",".rm",".vob",".sfd",".webm",
    ".xvid"
}

some_files = ["something.mpg", "some.jpg", "this.avi", "that.doc"]

for file_name in some_files:
    name, ext = os.path.splitext(file_name)
    if ext in video_format:
        print("Valid '{}' file '{}' found.".format(ext, file_name))
    else:
        print("'{}' is not a valid video format.".format(ext))
Output:
Valid '.mpg' file 'something.mpg' found. '.jpg' is not a valid video format. Valid '.avi' file 'this.avi' found. '.doc' is not a valid video format.



RE: Any suggestions for improvement?(my first python code) - PyAlex - Sep-07-2018

(Sep-07-2018, 03:33 PM)Mekire Wrote: One thing that jumps out is you don't need to interate through the file extensions.
You can store the file extension list as a set and use os.path.splitext to find the current file's extenstion.

Example:
import os


video_format = {
    ".3gp",".asf",".avi",".divx",".flv",".swf",".mp4",".mpeg", ".mpg",
    ".ogm",".wmv",".mov",".mkv",".nbr",".rm",".vob",".sfd",".webm",
    ".xvid"
}

some_files = ["something.mpg", "some.jpg", "this.avi", "that.doc"]

for file_name in some_files:
    name, ext = os.path.splitext(file_name)
    if ext in video_format:
        print("Valid '{}' file '{}' found.".format(ext, file_name))
    else:
        print("'{}' is not a valid video format.".format(ext))
Output:
Valid '.mpg' file 'something.mpg' found. '.jpg' is not a valid video format. Valid '.avi' file 'this.avi' found. '.doc' is not a valid video format.

If I understood correctly splittext() splits the string into two variables:
name --> the name of the file
ext --> the extension of the file

(Sep-07-2018, 03:33 PM)Mekire Wrote: One thing that jumps out is you don't need to interate through the file extensions. You can store the file extension list as a set and use os.path.splitext to find the current file's extenstion. Example:
import os video_format = { ".3gp",".asf",".avi",".divx",".flv",".swf",".mp4",".mpeg", ".mpg", ".ogm",".wmv",".mov",".mkv",".nbr",".rm",".vob",".sfd",".webm", ".xvid" } some_files = ["something.mpg", "some.jpg", "this.avi", "that.doc"] for file_name in some_files: name, ext = os.path.splitext(file_name) if ext in video_format: print("Valid '{}' file '{}' found.".format(ext, file_name)) else: print("'{}' is not a valid video format.".format(ext))
Output:
Valid '.mpg' file 'something.mpg' found. '.jpg' is not a valid video format. Valid '.avi' file 'this.avi' found. '.doc' is not a valid video format.
(Sep-07-2018, 03:31 PM)Larz60+ Wrote: the following are pycodestyle (which checks for PEP8 compatibility) generated issues. Code can run perfectly well without being compliant, but you should strive to get there.
Output:
PyAlex.py:3:10: E401 multiple imports on one line PyAlex.py:4:1: W293 blank line contains whitespace PyAlex.py:5:1: E265 block comment should start with '# ' PyAlex.py:5:80: E501 line too long (89 > 79 characters) PyAlex.py:6:1: E302 expected 2 blank lines, found 1 PyAlex.py:13:1: E305 expected 2 blank lines after class or function definition, found 0PyAlex.py:14:1: E265 block comment should start with '# ' PyAlex.py:14:80: E501 line too long (89 > 79 characters) PyAlex.py:15:1: W293 blank line contains whitespace PyAlex.py:18:23: E231 missing whitespace after ',' PyAlex.py:18:30: E231 missing whitespace after ',' PyAlex.py:18:37: E231 missing whitespace after ',' PyAlex.py:18:45: E231 missing whitespace after ',' PyAlex.py:18:52: E231 missing whitespace after ',' PyAlex.py:18:59: E231 missing whitespace after ',' PyAlex.py:18:66: E231 missing whitespace after ',' PyAlex.py:18:74: E231 missing whitespace after ',' PyAlex.py:18:80: E501 line too long (152 > 79 characters) PyAlex.py:18:81: E231 missing whitespace after ',' PyAlex.py:18:88: E231 missing whitespace after ',' PyAlex.py:18:95: E231 missing whitespace after ',' PyAlex.py:18:102: E231 missing whitespace after ',' PyAlex.py:18:109: E231 missing whitespace after ',' PyAlex.py:18:116: E231 missing whitespace after ',' PyAlex.py:18:122: E231 missing whitespace after ',' PyAlex.py:18:129: E231 missing whitespace after ',' PyAlex.py:18:136: E231 missing whitespace after ',' PyAlex.py:18:144: E231 missing whitespace after ',' PyAlex.py:21:1: W293 blank line contains whitespace PyAlex.py:22:1: E302 expected 2 blank lines, found 1 PyAlex.py:33:37: E231 missing whitespace after ',' PyAlex.py:35:80: E501 line too long (119 > 79 characters) PyAlex.py:37:1: W293 blank line contains whitespace PyAlex.py:38:1: E302 expected 2 blank lines, found 1 PyAlex.py:48:1: W293 blank line contains whitespace PyAlex.py:49:1: W293 blank line contains whitespace PyAlex.py:54:1: W293 blank line contains whitespace PyAlex.py:55:1: E302 expected 2 blank lines, found 1 PyAlex.py:60:80: E501 line too long (118 > 79 characters) PyAlex.py:60:109: E231 missing whitespace after ',' PyAlex.py:62:1: W293 blank line contains whitespace PyAlex.py:63:1: E305 expected 2 blank lines after class or function definition, found 1 PyAlex.py:64:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:64:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:40: W292 no newline at end of file
The following are pylint (only 2!) comments:
Output:
{ "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 26, "startColumn": 15, "endLineNumber": 26, "endColumn": 15 { "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 41, "startColumn": 15, "endLineNumber": 41, "endColumn": 15 } }
(Sep-07-2018, 03:31 PM)Larz60+ Wrote: the following are pycodestyle (which checks for PEP8 compatibility) generated issues. Code can run perfectly well without being compliant, but you should strive to get there.
Output:
PyAlex.py:3:10: E401 multiple imports on one line PyAlex.py:4:1: W293 blank line contains whitespace PyAlex.py:5:1: E265 block comment should start with '# ' PyAlex.py:5:80: E501 line too long (89 > 79 characters) PyAlex.py:6:1: E302 expected 2 blank lines, found 1 PyAlex.py:13:1: E305 expected 2 blank lines after class or function definition, found 0PyAlex.py:14:1: E265 block comment should start with '# ' PyAlex.py:14:80: E501 line too long (89 > 79 characters) PyAlex.py:15:1: W293 blank line contains whitespace PyAlex.py:18:23: E231 missing whitespace after ',' PyAlex.py:18:30: E231 missing whitespace after ',' PyAlex.py:18:37: E231 missing whitespace after ',' PyAlex.py:18:45: E231 missing whitespace after ',' PyAlex.py:18:52: E231 missing whitespace after ',' PyAlex.py:18:59: E231 missing whitespace after ',' PyAlex.py:18:66: E231 missing whitespace after ',' PyAlex.py:18:74: E231 missing whitespace after ',' PyAlex.py:18:80: E501 line too long (152 > 79 characters) PyAlex.py:18:81: E231 missing whitespace after ',' PyAlex.py:18:88: E231 missing whitespace after ',' PyAlex.py:18:95: E231 missing whitespace after ',' PyAlex.py:18:102: E231 missing whitespace after ',' PyAlex.py:18:109: E231 missing whitespace after ',' PyAlex.py:18:116: E231 missing whitespace after ',' PyAlex.py:18:122: E231 missing whitespace after ',' PyAlex.py:18:129: E231 missing whitespace after ',' PyAlex.py:18:136: E231 missing whitespace after ',' PyAlex.py:18:144: E231 missing whitespace after ',' PyAlex.py:21:1: W293 blank line contains whitespace PyAlex.py:22:1: E302 expected 2 blank lines, found 1 PyAlex.py:33:37: E231 missing whitespace after ',' PyAlex.py:35:80: E501 line too long (119 > 79 characters) PyAlex.py:37:1: W293 blank line contains whitespace PyAlex.py:38:1: E302 expected 2 blank lines, found 1 PyAlex.py:48:1: W293 blank line contains whitespace PyAlex.py:49:1: W293 blank line contains whitespace PyAlex.py:54:1: W293 blank line contains whitespace PyAlex.py:55:1: E302 expected 2 blank lines, found 1 PyAlex.py:60:80: E501 line too long (118 > 79 characters) PyAlex.py:60:109: E231 missing whitespace after ',' PyAlex.py:62:1: W293 blank line contains whitespace PyAlex.py:63:1: E305 expected 2 blank lines after class or function definition, found 1 PyAlex.py:64:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:64:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:40: W292 no newline at end of file
The following are pylint (only 2!) comments:
Output:
{ "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 26, "startColumn": 15, "endLineNumber": 26, "endColumn": 15 { "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 41, "startColumn": 15, "endLineNumber": 41, "endColumn": 15 } }

I started writing in python 5 days ago and i did not know there was a pycodestyle.
what is the PEP8 combatability?
How can I make the code compatible with PEP8?


RE: Any suggestions for improvement?(my first python code) - Mekire - Sep-07-2018

Pep8 is the official python style guide, found here:
https://www.python.org/dev/peps/pep-0008/

You can also use various programs that run auto linters to tell you all your pep8 discrepancies. This is what Larz did. Most of us follow pep8 fairly consistently, only deviating subtly when it suits our personal style. I don't personally use a linter but I'm consistent in my deviations which is the important part.


RE: Any suggestions for improvement?(my first python code) - Larz60+ - Sep-07-2018

when I first started using pycodestyle and pylint, I had quite a few warnings, so don't be put off by the list I posted
As I stated most are trivial, but since I started using these tools, my code is much more compliant first time around.
You can get both with pip:
pip install pycodestyle
pip install pylint



RE: Any suggestions for improvement?(my first python code) - PyAlex - Sep-07-2018

Ok thank you, i will install it


RE: Any suggestions for improvement?(my first python code) - PyAlex - Sep-08-2018

(Sep-07-2018, 03:31 PM)Larz60+ Wrote: the following are pycodestyle (which checks for PEP8 compatibility) generated issues.
Code can run perfectly well without being compliant, but you should strive to get there.
Output:
PyAlex.py:3:10: E401 multiple imports on one line PyAlex.py:4:1: W293 blank line contains whitespace PyAlex.py:5:1: E265 block comment should start with '# ' PyAlex.py:5:80: E501 line too long (89 > 79 characters) PyAlex.py:6:1: E302 expected 2 blank lines, found 1 PyAlex.py:13:1: E305 expected 2 blank lines after class or function definition, found 0PyAlex.py:14:1: E265 block comment should start with '# ' PyAlex.py:14:80: E501 line too long (89 > 79 characters) PyAlex.py:15:1: W293 blank line contains whitespace PyAlex.py:18:23: E231 missing whitespace after ',' PyAlex.py:18:30: E231 missing whitespace after ',' PyAlex.py:18:37: E231 missing whitespace after ',' PyAlex.py:18:45: E231 missing whitespace after ',' PyAlex.py:18:52: E231 missing whitespace after ',' PyAlex.py:18:59: E231 missing whitespace after ',' PyAlex.py:18:66: E231 missing whitespace after ',' PyAlex.py:18:74: E231 missing whitespace after ',' PyAlex.py:18:80: E501 line too long (152 > 79 characters) PyAlex.py:18:81: E231 missing whitespace after ',' PyAlex.py:18:88: E231 missing whitespace after ',' PyAlex.py:18:95: E231 missing whitespace after ',' PyAlex.py:18:102: E231 missing whitespace after ',' PyAlex.py:18:109: E231 missing whitespace after ',' PyAlex.py:18:116: E231 missing whitespace after ',' PyAlex.py:18:122: E231 missing whitespace after ',' PyAlex.py:18:129: E231 missing whitespace after ',' PyAlex.py:18:136: E231 missing whitespace after ',' PyAlex.py:18:144: E231 missing whitespace after ',' PyAlex.py:21:1: W293 blank line contains whitespace PyAlex.py:22:1: E302 expected 2 blank lines, found 1 PyAlex.py:33:37: E231 missing whitespace after ',' PyAlex.py:35:80: E501 line too long (119 > 79 characters) PyAlex.py:37:1: W293 blank line contains whitespace PyAlex.py:38:1: E302 expected 2 blank lines, found 1 PyAlex.py:48:1: W293 blank line contains whitespace PyAlex.py:49:1: W293 blank line contains whitespace PyAlex.py:54:1: W293 blank line contains whitespace PyAlex.py:55:1: E302 expected 2 blank lines, found 1 PyAlex.py:60:80: E501 line too long (118 > 79 characters) PyAlex.py:60:109: E231 missing whitespace after ',' PyAlex.py:62:1: W293 blank line contains whitespace PyAlex.py:63:1: E305 expected 2 blank lines after class or function definition, found 1 PyAlex.py:64:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:64:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:18: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:20: E251 unexpected spaces around keyword / parameter equals PyAlex.py:65:40: W292 no newline at end of file
The following are pylint (only 2!) comments:
Output:
{ "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 26, "startColumn": 15, "endLineNumber": 26, "endColumn": 15 { "resource": ".../CodeReview/src/PyAlex.py", "owner": "python", "code": "W0612", "severity": 4, "message": "W0612:Unused variable 's_dirs'", "source": "pylint", "startLineNumber": 41, "startColumn": 15, "endLineNumber": 41, "endColumn": 15 } }

Why pycodestyle give me only these error:

C:\file.py:3:10: E401 multiple imports on one line
C:\file.py:5:1: E265 block comment should start with '# '
C:\file.py:5:80: E501 line too long (89 > 79 characters)
C:\file.py:6:1: E302 expected 2 blank lines, found 1
C:\file.py:13:1: E305 expected 2 blank lines after class or function definition, found 0
C:\file.py:18:23: E231 missing whitespace after ','
C:\file.py:37:1: W293 blank line contains whitespace
C:\file.py:64:18: E251 unexpected spaces around keyword / parameter equals
C:\file.py:67:1: W391 blank line at end of file


and pylint:

C:\file.py:35:0: C0301: Line too long (119/100) (line-too-long)
C:\file.py:37:0: C0303: Trailing whitespace (trailing-whitespace)
C:\file.py:49:0: C0303: Trailing whitespace (trailing-whitespace)
C:\file.py:60:0: C0301: Line too long (118/100) (line-too-long)
C:\file.py:60:108: C0326: Exactly one space required after comma
print(f"|{'▒'*int(perce/2)}{' '*(50-int(perce/2))}| {perce}% {current_file[:20]} {current_perc}%",end="\r")
^ (bad-whitespace)
C:\file.py:62:0: C0303: Trailing whitespace (trailing-whitespace)
C:\file.py:64:18: C0326: No space allowed around keyword argument assignment
Thread(target = move_file).start()
^ (bad-whitespace)
C:\file.py:65:18: C0326: No space allowed around keyword argument assignment
Thread(target = print_perc).start()
^ (bad-whitespace)
C:\file.py:67:0: C0305: Trailing newlines (trailing-newlines)
C:\file.py:1:0: C0111: Missing module docstring (missing-docstring)
C:\file.py:3:0: C0410: Multiple imports on one line (os, shutil, time) (multiple-imports)
C:\file.py:16:0: C0103: Constant name "download" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:18:0: C0103: Constant name "video_format" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:19:0: C0103: Constant name "current_file" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:20:0: C0103: Constant name "current_file_size" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:22:0: C0111: Missing function docstring (missing-docstring)
C:\file.py:23:4: C0103: Constant name "current_file" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:23:4: W0603: Using the global statement (global-statement)
C:\file.py:24:4: C0103: Constant name "current_file_size" doesn't conform to UPPER_CASE naming style (invalid-name)
C:\file.py:24:4: W0603: Using the global statement (global-statement)
C:\file.py:26:14: W0612: Unused variable 's_dirs' (unused-variable)
C:\file.py:38:0: C0111: Missing function docstring (missing-docstring)
C:\file.py:41:14: W0612: Unused variable 's_dirs' (unused-variable)
C:\file.py:50:0: C0111: Missing function docstring (missing-docstring)
C:\file.py:55:0: C0111: Missing function docstring (missing-docstring)
C:\file.py:1:0: W0611: Unused import threading (unused-import)



RE: Any suggestions for improvement?(my first python code) - Larz60+ - Sep-08-2018

I can't answer that question?
different options turned on?


RE: Any suggestions for improvement?(my first python code) - PyAlex - Sep-08-2018

No, i installed and run it from cmd