python - Using Numpy from keyword.py -
i want use numpy in python script uses pandas
process excel file. however, 1 of constraints file must named keyword.py
, causes import error. import error traced line from keyword import iskeyword _iskeyword
in c:\python27\lib\collections.py
, assume causes error because own keyword.py
overriding default keyword
module. there way avoid collision?
not pretty, keyword.py
of
if true: import imp, sys keyword_loc = imp.find_module("keyword", sys.path[1:])[1] imp.load_source("keyword", keyword_loc) import collections print(collections.counter)
fails attributeerror if replace true
false
, gives me
(2.7) dsm@notebook:~/coding/kw$ python keyword.py <class 'collections.counter'>
as is. works finding out original keyword library , manually importing it. after this, following attempts import keyword
see it's there.
Comments
Post a Comment