Re: [Tutor] Help error 504

2015-08-25 Thread Danny Yoo
Unit tests that depend on external dependencies can be "flaky": they might fail for reasons that you don't anticipate. I'd recommend not depending on an external web site like this: it puts load on someone else, which they might not appreciate. Making the test not depend on the network is not ba

Re: [Tutor] PyQt4 Draggable button

2015-08-25 Thread Laura Creighton
Turns out this has been answered several times on Stack Overflow, nobody mentioned using Designer, but there is plenty of code to crib from. Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.

Re: [Tutor] PyQt4 Draggable button

2015-08-25 Thread Alan Gauld
On 25/08/15 11:51, Ankit Pareek wrote: How can I create Draggable buttons in PyQt4 , which can be moved using mouse. Can I create using Qt Designer or I have to code. This list is for questions about the Python language and standard library so PyQt is a bit off topic and you might get a better

[Tutor] PyQt4 Draggable button

2015-08-25 Thread Ankit Pareek
How can I create Draggable buttons in PyQt4 , which can be moved using mouse. Can I create using Qt Designer or I have to code. Please help me. Thanks in advance. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

Re: [Tutor] Complications Take Two (Long) Frustrations.

2015-08-25 Thread Roel Schroeven
Steven D'Aprano schreef op 2015-08-22 09:00: On Fri, Aug 21, 2015 at 11:29:52PM +0200, Roel Schroeven wrote: Joel Goldstick schreef op 2015-08-21 23:22: so: print -max(-A, -B) That's what I mean, yes. I haven't tried it, but I don't see why it wouldn't work. It won't work with anything wh

Re: [Tutor] Help error 504

2015-08-25 Thread Laura Creighton
Thanks Timo! I never heard of this one before! Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help error 504

2015-08-25 Thread Peter Otten
Timo wrote: > Op 25-08-15 om 02:08 schreef Gonzalo V: >> how can simulate or emulate an error 504? > I think using a site like http://httpbin.org/ is a bit easier than mock > or your own server. > Just change your request url to: > http://httpbin.org/status/504 Yes, that's nice! Plus, it's

Re: [Tutor] Help error 504

2015-08-25 Thread Timo
Op 25-08-15 om 02:08 schreef Gonzalo V: how can simulate or emulate an error 504? I think using a site like http://httpbin.org/ is a bit easier than mock or your own server. Just change your request url to: http://httpbin.org/status/504 Timo i am new in python and its very intuitive! but

Re: [Tutor] Help error 504

2015-08-25 Thread Peter Otten
Gonzalo V wrote: > i am new in python and its very intuitive! but i am in problems with that > code. As Danny already explained an exception can only be caught if the function is inside a try ... except ...: try: req = urllib.request.urlopen(...) except urllib.error.HTTPError as e: ...

Re: [Tutor] Help error 504

2015-08-25 Thread Laura Creighton
I use mock for this. See this blog post which explains it much clearer than I could. http://engineroom.trackmaven.com/blog/real-life-mocking/ Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyt

Re: [Tutor] Help error 504

2015-08-25 Thread Danny Yoo
In your program, you have a try/ except block, but it does not surround the line: req=urllib.request.urlopen(''+line) You probably should modify the extent of the exception handling to include that part. If you are seeing a 504, I expect it to come at this point. __

[Tutor] Help error 504

2015-08-25 Thread Gonzalo V
how can simulate or emulate an error 504? i am new in python and its very intuitive! but i am in problems with that code. i wrote this code and it cant handle 504 error: import urllib.request import urllib.error from bs4 import BeautifulSoup import re, csv from FuncionCsv import LlenarCsv fhand