我正在从一个有<代码>env的一些环境变数的假装图书馆图书馆的原始文件上传阅一个短信。
这从指挥线出发,但当我试图以下列方式作为跳板时:
* * * * * source ./path_to_venv/activate; python ./path_to_script.py
我遇到一个重大错误,因为它可能发现环境变化。
有什么想法说明为什么不这样做?
许多人感谢任何帮助!
我正在从一个有<代码>env的一些环境变数的假装图书馆图书馆的原始文件上传阅一个短信。
这从指挥线出发,但当我试图以下列方式作为跳板时:
* * * * * source ./path_to_venv/activate; python ./path_to_script.py
我遇到一个重大错误,因为它可能发现环境变化。
有什么想法说明为什么不这样做?
许多人感谢任何帮助!
I don t know if there s a more elegant solution with this one. I was able to make my script work in crontab by adding the environment variables at the top of the cronjob.
API_KEY=value
API_KEY_SECRET=value
ACCESS_TOKEN=value=value
ACCESS_TOKEN_SECRET=value
# run on 8hrs interval
0 */8 * * * . $HOME/Coding/python/web-scraper-corona/venv/bin/activate && $HOME/Coding/python/web-scraper-corona/venv/bin/python3 /home/chan-dev/Coding/python/web-scraper-corona/twitter-covid19-bot.py >> /tmp/test.txt 2>&1
如果你重新使用<代码>dotenvsfall config path,则从path.resolve(process.cwd(), env )
解决,在从<代码>cron上操作你的文字时,你将无法解决你的期望。
因此,如果贵国的<代码>.env文档与您的文字相同,则使用这个例子:
const dotenv = require( dotenv )
dotenv.config({ path: __dirname + /.env })
Node.js ES6-way, without any external model:
// env.js
import dotenv from dotenv
const _dirname = new URL( . , import.meta.url).pathname
dotenv.config({ path: _dirname + .env })
// yourmodule.js
import _ from ./env.js
// use process.env
如果你重新努力处理像我这样的几个因素,有几个问题。 真正的、单纯的六氯环己烷,是装满甲壳的 has,甚至集装箱内的安全风险。 但是,如果你重新使用狗,问题很可能是将硬木(crontab 确实不知道你在什么地方)、一些基本伐木(看真实错误)和最后安装的硬木用户需要结合起来!
Try:
envpath = join(dirname( /var/www/node-folder/approot/ ), .env )
* * * * * sudo -H PYTHONPATH=/usr/bin/python3 /usr/bin/python3 /var/www/node-folder/approot/app.py >> /var/log/app.log 2>&1
例:
from sqlalchemy import create_engine,text
ModuleNotFoundError: No module named sqlalchemy
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...
Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...
Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...
I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...
I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...