These are chat archives for Codewars/

Jul 2018
Jul 14 12:26
Hello to all - didn't know there was this chat room - nice :)
Is there a known problem with
Tried in python 2 and 3, and both give server errors: urllib2.HTTPError: HTTP Error 500: Internal Server Error and urllib.error.HTTPError: HTTP Error 500: Internal Server Error.
Donald Sebastian Leung
Jul 14 13:01
@chutetearer2013 I haven't solved that Kata myself yet but I've heard it's about scraping (a technique that apparently does not involve querying the CW server)
Jul 14 13:02
It is scraping
Also no, the kata works last I checked
It's possible the server's having issues atm
Oh my mistake... I did get the year a codewarrior joined, not get a user's honor.
I was actually annoyed he was allowed to make two separate kata doing basically the same thing
you're using import urllib.request ?
Jul 14 16:04
Jul 14 19:44

thanks for your answers. Yes I am using urllib.request (urllib2 in python 2). Both versions work in CW and give the correct answer but when I submit with "attempt" the following error is displayed:

Traceback (most recent call last):
File "", line 30, in <module>
test.assert_equals(get_honor('dpleshkov'), control('dpleshkov'))
File "/home/codewarrior/", line 5, in get_honor
with urllib.request.urlopen(url) as f:
File "/usr/local/lib/python3.4/urllib/", line 161, in urlopen
return, data, timeout)
File "/usr/local/lib/python3.4/urllib/", line 470, in open
response = meth(req, response)
File "/usr/local/lib/python3.4/urllib/", line 580, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python3.4/urllib/", line 508, in error
return self._call_chain(args)
File "/usr/local/lib/python3.4/urllib/", line 442, in _call_chain
result = func(
File "/usr/local/lib/python3.4/urllib/", line 588, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

Will have a look at

Jul 14 20:30
Does your solution work when used in 'Example tests' section? If it works with example tests, but not with final tests, then I'd guess that reference solution, for some reason, stopped to work :(
Jul 14 20:47
User "dpleshkov" doesn't exist, so it's a kata issue.
Jul 14 20:52
python question, guys: how can I achieve in python thing similar to following javascript expression: let value = m[3] || ""; - I mean the "assign '' if m[3] does not exist in the array" part
Jul 14 20:57
okay, got it I think, I still forget that I sohuld use or instead of ||
Jul 14 20:58
Not really the same but.. return "" if len(m) <= 3 else m[3]
Dont you get index out of range with m[3] or "" ?
Jul 14 21:02
ah you are right, I was mistaken because m[3] actually was in bounds, but empty
ok so I need a conditional expression then
if index is out of bounds
Jul 14 21:03
Hah, I forgot that that kind of short circuiting relies on out of bounds indexes not throwing an exception
Jul 14 23:45

Even just:

def get_honor(username):

bugs. It prints the right name and crashes with a similar message as above