ich habe jetzt wx mit punkt ersetzt wx.
in turbobt.py
und nun habe ich das fehler:
Code: Alles auswählen
Traceback (most recent call last):
File "E:\bit-tests\turbobt\turbobt.py", line 1385, in ?
run(argv[1:])
NameError: name 'argv' is not defined
Code: Alles auswählen
def next(params, d, doneflag):
dow = Download()
d.dow = dow
d.dow.minPort=d.setting['portstart']
d.dow.maxPort=d.setting['portend']
dow.download(params, d.chooseFile, d.updateStatus, d.finished, d.error, doneflag, 100,
d.newpath)
if not d.fin:
d.failed()
def run(params):
app = MyApp(0,params)
app.MainLoop()
if __name__ == "__main__":
run(argv[1:])
2.Habe noch ein ganz anderes problem mit
download.py
im orginal code das ich eben das gleiche in mein eigenes download.py
übernehmen will ist der bereich proxy
Code: Alles auswählen
def download(params, filefunc, statusfunc, finfunc, errorfunc, doneflag, cols, pathFunc = None, paramfunc = None, spewflag = Event()):
if len(params) == 0:
errorfunc('arguments are -\n' + formatDefinitions(defaults, cols))
return
try:
config, args = parseargs(params, defaults, 0, 1)
if args:
if config.get('responsefile', None) == None:
raise ValueError, 'must have responsefile as arg or parameter, not both'
if path.isfile(args[0]):
config['responsefile'] = args[0]
else:
config['url'] = args[0]
if (config['responsefile'] == '') == (config['url'] == ''):
raise ValueError, 'need responsefile or url'
except ValueError, e:
errorfunc('error: ' + str(e) + '\nrun with no args for parameter explanations')
return
try:
if config['responsefile'] != '':
h = open(config['responsefile'], 'rb')
else:
#: use proxy
h = urlopen(config['url'], config['http_proxy'])
#/
response = h.read()
h.close()
except IOError, e:
da es etwas unterschied gibt zu dem anderen download.py
habe ich ein problem
habe den gleichen code eingesetzt aber irgendwie falsch das mir fehler ausgibt im cmd:
Code: Alles auswählen
Traceback (most recent call last):
File "E:\bit-tests\turbobt\turbobt.py", line 39, in ?
from btsession import BTSession
File "E:\bit-tests\turbobt\btsession.py", line 21, in ?
from BitTorrent.download import Download
File "E:\bit-tests\turbobt\BitTorrent\download.py", line 142
h = urlopen(config['url'], config['http_proxy'])
^
IndentationError: expected an indented block
Code: Alles auswählen
class Download:
def ParseResponseFile(self, responsefile, url=None, errorfunc=None):
try:
if responsefile and responsefile != '':
h = open(responsefile, 'rb')
elif url != None:
h = urlopen(url)
else:
#: use proxy
h = urlopen(config['url'], config['http_proxy'])
#/
response = h.read()
h.close()
except IOError, e:
if responsefile != '' and responsefile.find('Temporary Internet Files') != -1:
if errorfunc != None:
da muss irgendwie das anders machen oder das es geht?