shichao-an / twitter-photos

Simple, fast command-line tool to get photos from Twitter accounts
https://twitter-photos.shichao.io
BSD 2-Clause "Simplified" License
171 stars 39 forks source link

Unable to read credentials #9

Open rushirene opened 7 years ago

rushirene commented 7 years ago

Each time I try to open twphotos on the terminal I get the following message:

Traceback (most recent call last): File "/usr/local/bin/twphotos", line 7, in from twphotos.photos import main File "/usr/local/lib/python2.7/dist-packages/twphotos/photos.py", line 9, in from .settings import (CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, File "/usr/local/lib/python2.7/dist-packages/twphotos/settings.py", line 44, in raise Exception('No credentials found.') Exception: No credentials found.

I've already put the "credentials.ini"/"credentials.cfg" files inside the /twphotos folder and I still get the same error.

Am I doing something wrong?

shichao-an commented 7 years ago

You don't need to create a directory. The config file itself is ~/.twphotos. For example:

$ cat ~/.twphotos
[credentials]
consumer_key = your_consumer_key
consumer_secret = your_consumer_secret
access_token_key = your_access_token_key
access_token_secret = your_access_token_secret
rushirene commented 7 years ago

Tried again, but the terminal tells me that there's not file or directory with that name. Btw, the program is installed in the root folder since I have full-disk encryption. Maybe it has something to do with it?

Honowski commented 7 years ago

Where is the .twphotos file located? It appears to be a hidden file but when i edit it to my consumer_keys I still get the same error as above.

rushirene commented 7 years ago

Well, tried everything. I downloaded VirtualBox to install the program in an unencrypted disk. Installed through pip, then tried the distribution and still nothing. There wasn't a .twphotos config file (like the test one in the distribution), so I moved the test file with the correct credentials into the unencrypted "twphotos" folder and it still didn't read the file.

I don't know what I'm doing wrong.

ajinkyakolhe commented 7 years ago

I am facing exactly the same problem and would like to know the folder where this file is to be placed.

shichao-an commented 7 years ago

@ajinkyakolhe the folder is your home folder. On Unix systems, it's identified by $HOME or ~ (tilde expansion), so the full path of the config file is something like /home/yourname/.twphotos on Linux and /Users/yourname/.twphotos on OS X. Note that .twphotos is a file in your home directory. You have to run twphotos as yourself, not as other users, so that twphotos can find your config file.