https://github.com/nitsc/real-time-python
RTPY(实时Python)是一个 Python 脚本,旨在根据配置文件的设定频率,自动执行指定的 Python 程序。该工具适用于需要频繁调试的代码。
https://github.com/nitsc/real-time-python
auto-run auto-runner automation convenient debug debugging-tool development program programming programming-language python python3 real-time realtime realtime-processing smart subprocess system text time
Last synced: 3 months ago
JSON representation
RTPY(实时Python)是一个 Python 脚本,旨在根据配置文件的设定频率,自动执行指定的 Python 程序。该工具适用于需要频繁调试的代码。
- Host: GitHub
- URL: https://github.com/nitsc/real-time-python
- Owner: nitsc
- License: agpl-3.0
- Created: 2024-10-01T09:47:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-18T07:35:59.000Z (11 months ago)
- Last Synced: 2025-10-08T19:19:36.518Z (3 months ago)
- Topics: auto-run, auto-runner, automation, convenient, debug, debugging-tool, development, program, programming, programming-language, python, python3, real-time, realtime, realtime-processing, smart, subprocess, system, text, time
- Language: Python
- Homepage: https://blog.csdn.net/zwa20110606/article/details/142672981?sharetype=blogdetail&sharerId=142672981&sharerefer=PC&sharesource=zwa20110606&spm=1011.2480.3001.8118
- Size: 5.73 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Realtime Python (rtpy.py) 使用说明
---
## 概述

`Realtime Python(rtpy.py)` 是一个 Python 脚本,旨在根据配置文件的设定频率,自动执行指定的 Python 程序。该工具适用于需要频繁调试的代码。
## 文件结构
- **rtpy.py**: 主程序文件,负责读取配置文件并定期运行指定的 Python 脚本。
- **py文件**: 包含 执行频率 和 Python解释器路径 以及 脚本。
## py文件格式
py文件必须包含以下两行:
1. 执行频率(公式:停顿时间 * 60)。
2. Python 解释器的路径。
3. Python 脚本
示例配置文件内容:
```
# 120
# C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python311\\python.exe
a = input("what is your name? ")
print("hello " + a + "!")
```
其中,第一行使得 Python Realtime 每2秒执行一次代码,第二行是 Python 解释器的路径,第三行和以后是 Python 脚本。
## 使用方法
1. 使用已打包的 EXE 文件(rtpy.exe):
```bash
rtpy <脚本文件路径>
```
例如:
```bash
rtpy text.py
```
2. 程序将读取文件中的执行频率和 Python 解释器路径,并根据设定的频率定期运行指定的 Python 脚本。
## 主要功能
- **读取配置文件**: `read_config(path)` 负责读取文件,并返回执行频率和 Python 解释器路径。
- **执行脚本**: `job(path, py_path)` 根据文件中的解释器路径执行指定的 Python 脚本。
- **定期执行**: `run()` 是主函数,它读取命令行参数,获取配置文件路径,并启动定期执行任务的循环。
## 注意事项
- 确保py文件格式正确,否则程序会提示格式错误。
- 该脚本只经过 Windows11 的测试,其余系统没经测试,可能需要略微调整。