N
N
NitroDesktop2020-05-08 13:24:28
Python
NitroDesktop, 2020-05-08 13:24:28

How to implement wget bulk download of python files???

If one link works, if there are many errors, write the module type, etc.

Mistakes


Traceback (most recent call last):
  File "d:\python\file.py", line 14, in <module>
    sFile=wget.download(line)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\wget.py", line 506, in download
    (fd, tmpfile) = tempfile.mkstemp(".tmp", prefix=prefix, dir=".")
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\tempfile.py", line 332, in mkstemp
    return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\tempfile.py", line 250, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
OSError: [Errno 22] Invalid argument: '.\\picasa39-setup.exe\njyi8jgg1.tmp'



import os,wget,tempfile

f = open('text.txt')
sLine=0
sDon=0
sFile=""
for line in f.readlines():
    sLine += 1
    if line!="":
        print(line)
        print(sLine)
        if sDon == 0:
            sFile=wget.download(line)
            print(sFile)
            sDon=1
            if sFile:
                os.system(sFile)
                sDon=0
f.close()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Karbivnichy, 2020-05-08
@NitroDesktop

Here, "a little" simplified, checked - it works:

import os,wget

with open('text.txt') as file:
  lines = file.read().splitlines()

for line in lines:
  sFile = wget.download(line)
  print(sFile)

D
Dimonchik, 2020-05-08
@dimonchik2013

this is not the same wget

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question