[Baypiggies] importing variables into python namespace using argparse module

Eric Walstad eric at ericwalstad.com
Thu Sep 8 00:08:11 CEST 2011


Hi Abhishek,

In the future please include the full error traceback.  It includes
information that helps in debugging.

It looks like your sam_file_1 variable contains a list when a string
is expected.  You could try printing the value of that variable before
passing it to your read_file function to see what it contains.  You've
changed your code and didn't include all the changes.

Eric.


On Wed, Sep 7, 2011 at 2:56 PM, Abhishek Pratap <abhishek.vit at gmail.com> wrote:
> Guys
>
> I think I am stuck again while trying to open a file. It looks like a
> type casting error but not sure.
>
> ##Error:
> TypeError: coercing to Unicode: need string or buffer, list found
>
>
> #code
>
> def read_file(file):
>    """Read the first same and create a dictionary
>    """
>    fh1 = open(file,'r')
>    for line in fh1:
>        print line
>
>
> sam_file_1 = args.sam_file_1
> sam_file_2 = args.sam_file_2
>
> read_file(sam_file_1)
>
>
> -Abhi


More information about the Baypiggies mailing list