Dumb Newbie Question
Matthew Dixon Cowles
matt at mondoinfo.com
Sat Dec 9 14:12:57 EST 2000
On Sat, 09 Dec 2000 13:42:09 -0500, Scott Weisel <sweisel at drew.edu>
wrote:
>I thought I might be able to modify sys.path like this
>sys.path = sys.path + "c:\\python16\\programs
>but I'm getting a TypeError stating "illegal argument type for
>built-in operation."
Scott,
sys.path is a list and the + operator won't append a string to a
list. You want either:
sys.path=sys.path+["c:\\python16\\programs"]
since + will concatenate two lists or else
sys.path.append("c:\\python16\\programs")
since a list's append method will take a string.
But I think it's more common to write:
sys.path.insert(0,"c:\\python16\\programs")
to put your own directory up front so that in case of a name conflict, it's
your own stuff that's picked up.
Regards,
Matt
More information about the Python-list
mailing list