Forum Archive

trouble with first program

cb

hi folks,
i have some trouble with pythonista on ipad... (i am complete new here and also new to python) under Mac OS this code runs without error in PyCharm with 3.6.

def extract_redirect_url(r):
    return redurl_re.search(r.text).group(1)

but with pythonista the following error occurs "NoneType object has not attribute "group".

I think the problem is in re.py

please help

cb

JonB

Your search returned None, so group1 does not exist. You should break up the statement and check for a valid result before trying to use it.

cb

@JonB thanks a lot for your tip. i had searched a wrong phrase... sorry and thanks
cb