Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html'

Tags:

python

ioerror

I installed a package finsymbols in python by

pip install finsymbols

the installation went fine. But when I tried to work with that, there was an error saying that permission denied. The code I have tried is

>>>import finsymbols
>>>sp500 = finsymbols.get_sp500_symbols()
    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbols.py", line 8, in get_sp500_symbols
    page_html = wiki_html('List_of_S%26P_500_companies', 'SP500.html')
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbol_helper.py", line 94, in wiki_html
    save_file(file_path, wiki_html)
  File "/usr/local/lib/python2.7/dist-packages/finsymbols/symbol_helper.py", line 39, in save_file
    saved_file = open(file_path, "w")
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html'

can anyone help me in solving this ? Thanks

like image 899
Bhargav Avatar asked Sep 15 '25 09:09

Bhargav


2 Answers

The cause of the error is that you do not have write access to the finsymbols package folder.

Give the folder write access and try again:

sudo chmod a+w /usr/local/lib/python2.7/dist-packages/finsymbols

If you do not want to give access to that folder, run your python as a root user.

like image 72
greedy52 Avatar answered Sep 17 '25 22:09

greedy52


The better approach would be to use virtualenv This would have allowed you to install any package without requiring elevated permissions.

You can get a quick guide by visiting https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/

like image 39
Skillachie Avatar answered Sep 17 '25 23:09

Skillachie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!