Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to save the environment variables locally? #61

Open
KavyaKinjalk opened this issue May 16, 2022 · 12 comments
Open

Where to save the environment variables locally? #61

KavyaKinjalk opened this issue May 16, 2022 · 12 comments

Comments

@KavyaKinjalk
Copy link

I am trying to run this bot locally, but I cannot find where to save the .env file. Where do I save it?

@imner0
Copy link

imner0 commented Mar 1, 2023

did you find out?

@erickyun
Copy link

did any of you find it?

@KavyaKinjalk
Copy link
Author

KavyaKinjalk commented Oct 15, 2023 via email

@imner0
Copy link

imner0 commented Oct 15, 2023

Can you explained how to name the file and how you put variables in that file can you share Screenshot both

@erickyun
Copy link

Can you explain please?

Like this maybe??

.env

API_ID="12345"
API_HASH="xxxx"
SESSION_STRING = "xxxxxx"
INDEX_SETTINGS="{
  "index_all": true,
  "index_private": false,
  "index_group": false,
  "index_channel": true,
  "exclude_chats": [],
  "include_chats": []
}"

@imner0
Copy link

imner0 commented Oct 15, 2023

Thank you bro.

Did you try to run with replit?
I tried so many time but didn't work

@erickyun
Copy link

Thank you bro.

Did you try to run with replit? I tried so many time but didn't work

How did you setup .env file? Screenshot please?

@KavyaKinjalk
Copy link
Author

KavyaKinjalk commented Oct 15, 2023 via email

@KavyaKinjalk
Copy link
Author

KavyaKinjalk commented Oct 15, 2023 via email

@KavyaKinjalk
Copy link
Author

KavyaKinjalk commented Oct 15, 2023 via email

@erickyun
Copy link

The location of env file is on the left, and right is the format of env file. It is rte same as what you sent.

Which python version do you have sir?

I am trying to run this on Android Termux and Im still getting this error?

~/tg-index $ python3 -m app
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/tg-index/app/config.py", line 22, in <module>
    api_hash = os.environ["API_HASH"]
               ~~~~~~~~~~^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'API_HASH'


Please set the API_ID and API_HASH environment variables correctly
You can get your own API keys at https://my.telegram.org/apps
~/tg-index $

@erickyun
Copy link

erickyun commented Oct 16, 2023

you are correctl using the env file. You just have to put the env file in the "app" directory. Replit does not work anymore because it changed how dependency packages are installed, so you cannot install telethon. Some packages redundancy has changed as well, such as for aiohttp-jinja2. So you cannot run it on replit further, but it is possible to run it locally.

Could you maybe share your tg-index as zip?
Also python version and which modules version you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants