How to pass results of urllib2.urlopen to a function
Question: WHen I run this I get the following error - TypeError: coercing to Unicode:
need string or buffer, NoneType found

Can someone please tell me how I can pass the results of function getURL() to
function romid()?

    
    
    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    
    import serial, time, os, decimal, csv, urllib2, socket
    import xml.etree.cElementTree as ET
    from xml.etree.cElementTree import parse
    
    romidList = []
        id = '{http://www.embeddeddatasystems.com/schema/owserver}ROMId'
        owd= '{http://www.embeddeddatasystems.com/schema/owserver}owd_DS18B20'
    
    def getURL():
        f = urllib2.urlopen(''.join(['http://', '169.254.1.2', '/details.xml']))
        #add the next line
        return f
    
    def romid():
        f = getURL()
        for x in parse(f).findall(owd):
    
            romID = x.find(id) 
            romID = romID.text
    
            if romID not in romidList:
    
                romidList.append(romID)
    
            print romidList
    
    romid()
    


Answer: well...have you considered using the `return` statement in your `getURL`
function?

