Hey everybody,
probably stupid question, but I do not understand what is wrong there, I guess I just do not know how to properly open a file in a function. Having my csv file in the folder, I want to make a list out of the it:

    def make_OTU_list(csvfile):
        with open(csvfile, "rb") as list_input:
            csv = csv.reader(list_input)
            list_OTU = list(csv)[0]
            return list_OTU
            
    make_OTU_list("OTU95_dominating.csv")

and I come back with that:

    Traceback (most recent call last):
      File "labbook.py", line 35, in <module>
        make_OTU_list("OTU95_dominating.csv")
      File "labbook.py", line 31, in make_OTU_list
        csv = csv.reader(list_input)
    UnboundLocalError: local variable 'csv' referenced before assignment

Can somebody solve my problem?
Thanks a lot!
Look at the error message: "local variable 'csv' referenced before assignment"

1. Have you imported the csv library?
2. If yes, you should also use another variable name than csv to avoid confusion.
3. You probably want to write the list of the function into a variable.

( 4. Not really a bioinformatic question )

    import csv
    
    def make_OTU_list(csvfile):
        with open(csvfile, "rb") as list_input:
            csv_reader = csv.reader(list_input)
            list_OTU = list(csv_reader)[0]
            return list_OTU
    
    your_list = make_OTU_list("OTU95_dominating.csv")