skillachie / finsymbols

Obtains stock symbols and relating information for SP500, AMEX, NYSE, and NASDAQ
109 stars 41 forks source link

Permission denied error after pip install #13

Closed kennychowdhary closed 8 years ago

kennychowdhary commented 8 years ago

After running the command:

sp500 = finsymbols.get_sp500_symbols()

I get the following error:


IOError Traceback (most recent call last)

in () ----> 1 sp500 = finsymbols.get_sp500_symbols() /Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbols.pyc in get_sp500_symbols() 8 9 def get_sp500_symbols(): ---> 10 page_html = wiki_html('List_of_S%26P_500_companies','SP500.html') 11 wiki_soup = BeautifulSoup(page_html, "html.parser") 12 symbol_table = wiki_soup.find(attrs={'class': 'wikitable sortable'}) /Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbol_helper.pyc in wiki_html(url, file_name) 90 wiki_html = fetch_file('http://en.wikipedia.org/wiki/' + str(url)) 91 #Save file to be used by cache ---> 92 save_file(file_path,wiki_html) 93 return wiki_html /Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbol_helper.pyc in save_file(file_path, file_name) 36 37 def save_file(file_path,file_name): ---> 38 saved_file = open(file_path , "w") 39 saved_file.write(file_name) 40 saved_file.close() IOError: [Errno 13]*\* Permission denied**: '/Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/SP500.html'
skillachie commented 8 years ago

Hi Kenny, You need to either run the Python script with sudo . I assumed you did the above to install the module. However it would be better to start using virtualenv - http://docs.python-guide.org/en/latest/dev/virtualenvs/

http://pythontips.com/2013/07/30/what-is-virtualenv/

You will get that error if the module does not have write permissions to cache the SP500 file locally for 24 hours.