Seite 1 von 1

Wo finde ich die .env-Datei?

Verfasst: Montag 2. Dezember 2019, 22:23
von rilc0n
Vielleicht kann mir jemand helfen. Ich möchte gerne diesen Script installieren: https://github.com/glogiotatidis/tg-relay

In der Beschreibung steht:
Set API_ID and API_HASH to .env file or your environment.

Wie und wo mache ich das?

Wenn ich

Code: Alles auswählen

python3 listchannels.p
ausführe, bekomme ich folgende Meldung:

Code: Alles auswählen

Traceback (most recent call last):
  File "listchannels.py", line 6, in <module>
    import config
  File "/home/arturweiss/tg-relay/config.py", line 3, in <module>
    API_ID = config('1129586')
  File "/home/arturweiss/.local/lib/python3.7/site-packages/decouple.py", line 199, in __call__
    return self.config(*args, **kwargs)
  File "/home/arturweiss/.local/lib/python3.7/site-packages/decouple.py", line 83, in __call__
    return self.get(*args, **kwargs)
  File "/home/arturweiss/.local/lib/python3.7/site-packages/decouple.py", line 68, in get
    raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))
decouple.UndefinedValueError: 1129586 not found. Declare it as envvar or define a default value.
Ich nutze Ubuntu 19.04 und Python3.7

Re: Wo finde ich die .env-Datei?

Verfasst: Montag 2. Dezember 2019, 23:14
von __blackjack__
@rilc0n: Die Datei findest Du nicht, die musst Du anlegen. Oder Du sorgst dafür, das die Umgebungsvariablen gesetzt sind bevor Du das Programm startest. Oder gibst das als Default-Wert in der `config.py` wo es aber eigentlich nicht drin sein sollte.

Auf jeden Fall macht es keinen Sinn den *Namen* der Umgebungsvariable "APP_ID" in `config.py` durch den *Wert* zu ersetzen.

Re: Wo finde ich die .env-Datei?

Verfasst: Dienstag 3. Dezember 2019, 12:19
von rilc0n
Super, Danke... Das hat mein Problem gelöst