
[英]Pygame Button opens multiple applications
我正在尝试编写一个脚本,它有一个控制面板,您可以选择您想要打开的应用程序唯一的问题是它多次打开该应用程序请帮助只想打开它一次。 我认为问题是它检查我的鼠标按钮是否每秒被按下多次,因为我的鼠标只被按下一秒钟并且它每秒检查几次它执行 if 语句并完成它并多次打开应用程序次。 ...
[英]Pygame Button opens multiple applications
我正在尝试编写一个脚本,它有一个控制面板,您可以选择您想要打开的应用程序唯一的问题是它多次打开该应用程序请帮助只想打开它一次。 我认为问题是它检查我的鼠标按钮是否每秒被按下多次,因为我的鼠标只被按下一秒钟并且它每秒检查几次它执行 if 语句并完成它并多次打开应用程序次。 ...
[英]How to execute django query from string and get output
我想从一个字符串运行一个 Django 查询并将输出放入一个变量在我的 DRF 项目中,客户端发送了一个 Django 查询: 我需要返回这个查询的结果。 我尝试使用exec('model.objects.all()')但我无法将输出分配给变量,我也尝试使用subprocess.run([sys.e ...
[英]Make reports 'terminated' during linking step
我正在开发一个自动化的c++评分工具,它可以为学生代码构建和运行测试。 系统运行良好,但有时链接步骤会失败,并按照以下方式make报告: 有关更多上下文, make正在通过Python的子进程模块运行(autograder 是用Python编写的),并且正在运行 AWS EC2 实例运行 Ubun ...
[英]Execute terminal command over python
我正在尝试获取运行.py的主机名,所以我使用了: 但是,我得到了这个回报: 它总是从subprocess.Popen()打印None ,然后在print(server.stdout)主机名。 有没有办法来解决这个问题? ...
[英]Redirect subprocess stdout to stderr
Python 的subprocess API 的一个标准功能是使用关键字参数组合 STDERR 和 STDOUT 但目前我需要相反的方法:将命令的 STDOUT 重定向到 STDERR。 现在我正在使用subprocess.getoutput或subprocess.check_output手动执行 ...
[英]Python : Function issue with subprocess.run
早上好我使用 python 3.10.4 我在下面创建了 python 函数 当我执行它时,出现以下问题,因为 titi 不在命令中命令错误:参数不一致:env ENV、sys SYS、sub SUB、sn 1、type TYP、i、generate element 由于语法不正确导致命令失败您的意 ...
[英]How to restart a python program from within itself?
我正在尝试制作一款基于文本的冒险游戏,目前它直接在控制台中运行。 我希望能够在游戏结束后从头开始重新启动它。 我导入了 sys 和 os,但我对这两个模块都不是很熟悉,而且我从其他人那里找到的提出类似问题的解决方案似乎都不适用于我的代码。 ` ` 我试过 os.execv、os.execl、s ...
[英]How to start a terminal outside of the Deno App with Deno
这是我到目前为止所拥有的 我想要做的是启动一个独立于我的 Deno 应用程序运行的脚本,并且不会在我的主应用程序运行时结束。 我看过这里,似乎找不到任何东西。 任何指导将不胜感激。 我试过不等待结束,但它随着这个过程而消亡。 我试过阅读文档,但它看起来只创建了一个子流程。 ...
[英]Python subprocess.run ignores --exclude clause
我对subprocess.run有一个问题。 此命令在 Bash shell 中运行没有任何问题:tar -C '/home/' --exclude={'/home/user1/.cache','/home/user1/.config'} -caf '/transito/user1.tar' '/h ...
[英]python subprocess stdin truncated at first space
我对pOpen.communicate()有一个问题,我发送给子进程的字符串在第一次出现我发送给STDIN的空格字符时被截断(请记住,我正在使用编码utf-8编码为字节) 输入文件text.txt 我的代码from subprocess import Popen, PIPE # open file ...
[英]Running sphinx-apidoc in subprocess.run() in AzureDevops Pipeline (Ubuntu 20.04) gives no Errors and does not execute
问题正如标题所说,我试图在 Azure DevOps 构建管道中的 Ubuntu 20.04 上从 subprocess.run subprocess.run()运行sphinx-apidoc 。 我的问题是,我似乎收到错误消息,但没有消息,也没有真正执行任何内容? 我的代码是 我的 output ...
[英]python - AttributeError: 'NoneType' object has no attribute 'read'
写: Python 解析控制台并写入文件。 ...
[英]how to use matchbox keyboard using subprocess in raspberry pi?
我想在附有触摸屏的树莓派上运行我的代码。 GUI 是使用 pyqt5 制作的,我想在获得焦点时弹出系统屏幕键盘。 尝试了很多东西,但不知道如何使用它。 ...
[英]How to keep ROS publisher publishing while executing a subprocess callback?
如何让 ROS Publisher 在调用子流程时发布消息:import subprocess import rospy class Pub(): def __init__(self): pass def updateState(self, msg): ...
[英]subprocess.call can't find file/shutil.which failed in pycharm
我正在尝试使用子进程将 mp3 转换为pycharm中的 wav 文件 它返回找不到文件的错误,所以我将'ffmpeg'更改为它在我的电脑上的路径并且它可以工作。 问题是我正在制作一个应用程序,其他人可能会在其他人的位置安装 ffpmeg(因为它是用 zip 下载的,可以在任何地方解压缩),但我不知 ...
[英]Error while executing bash for loop from python subprocess
我想从此处提到的 python 运行此命令: 但我什至不能运行这个: 错误: 还尝试添加shell=True : 标准错误 output: 还尝试通过/bin/bash ,因为文档说shell=True使用/bin/sh 标准错误 output: ...
[英]Im trying to build an Installer for some packages that my programm needs. I also want to have a Status bar which shows the current progress
当我将我的 python 程序转换为 an.exe 时,tkinter window 多次打开,我认为这是因为子进程中断了 tkinterr window 的进程。我试图实现某种多处理,但它没有改变任何东西。我转换通过自动py-to-exe。 ...
[英]Python subprocess with dynamic variables and arguments
我想问一下,当 arguments 是动态的时,如何在 python 中运行 subprocess.run() 或 subprocess.call() 。 我已经将所有命令存储在一个外部批处理文件中,我想在更新 arguments 后使用 Python 运行批处理文件。我将在下面提供更多详细信息: ...
[英]Unable to run windows command using subprocess.Popen
我正在尝试运行一个简单的 windows 命令dir E:\Projects\ML /s /b使用subprocess.Popen function 而不使用Shell=True ,我的示例程序如下 使用os.system()命令给出了适当的结果但是使用Popen()我面临以下问题 我知道如果我设置 ...
[英]Writing to a file via subprocess.run() and TextIOWrapper.write() mixed up
运行以下代码片段时import subprocess with open('test', 'w') as f: f.write('foo\n') subprocess.run(['echo', 'bar'], stdout=f) 我实际上期望创建一个文件test ,其中第一行等于 ...