Python Forum
PYTHON - UNRAR : how can I build a thread to monitoring the downloading status
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PYTHON - UNRAR : how can I build a thread to monitoring the downloading status
#1
Hello to all of you,

I am posting this discussion because I have a problem. Indeed, I'm new to python and I'd like to get help on Threading.
I am currently developing an automation script to connect to an FTP, navigate to folders and download files.
This part is indeed finished but I would like to be able to make a thread to check for example (every 20min) if the download is going smoothly.

here is my download code:

class Download:

  def __init__(self):
    self.path="FolderFiles"
    self.target=" /var/www/folder/Output"

  def downloadFile(self):
    for root, dirs, files in os.walk(self.path, topdown=False):
      for name in files:
        print(name)
        rarFiles=os.path.join(root, name)
        unrar = "unrar x -y "+rarFiles+self.target
      os.system(unrar)
          #time.sleep(10)
PS: If you have other proposals other than Thread I am also listening
Thank you for your help
Reply
#2
Be aware that if you're ftp is from one server, you may get kicked off if you increase speed too much.
That being said, you may want to look at multiprocessing: https://docs.python.org/3.4/library/mult...ssing.html
Threading works well when you have idle CPU time, but not so when doing intensive things like downloading.
Multiprocessing is true parallel processing.
Reply
#3
After lot of test, I decided to work in this way: analyse the files after downloading in function of size, downloading time etc...
The unrar library cannot provides any solutions to test the good process during the downloading

Thank for your help
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  drawing a table with the status of tasks in each thread pyfoo 3 407 Mar-01-2024, 09:29 AM
Last Post: nerdyaks
  build Python 3.12 in el7 SergeyMx 5 1,221 Oct-05-2023, 08:14 AM
Last Post: SergeyMx
  Monitoring a Directory for new mkv and mp4 Files lastyle 3 1,622 May-07-2023, 12:33 PM
Last Post: deanhystad
  Downloading images from webpages H84Gabor 2 1,879 Sep-29-2021, 05:39 PM
Last Post: snippsat
  monitoring the temperature of the CPU with Python apollo 2 8,716 Apr-13-2021, 05:39 PM
Last Post: apollo
  IoT Air Monitoring System project_science 0 1,929 Mar-26-2021, 08:14 PM
Last Post: project_science
  How to link Sublime Text 3 Build system to Python 3.9 Using Windows 10 Fanman001 2 4,593 Mar-04-2021, 03:09 PM
Last Post: martpogs
  Compiling Python 3.8.5 source code results in build error Deepan 0 2,175 Sep-14-2020, 04:11 AM
Last Post: Deepan
  Build Python RPM pvbadiger05b 0 1,588 May-11-2020, 06:50 PM
Last Post: pvbadiger05b
  cannot build python 3.8.2 (make test fails on test_imprtlib) borabora 1 2,748 May-08-2020, 09:10 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020