[英]How do I run python libraries specific to command prompt on IDLE?
I wish to run some commands which are specifically made for command line interface in idle environment.我希望在空闲环境中运行一些专门为命令行界面制作的命令。
There is a library in python called "Ezflix" which is for streaming torrent videos. python中有一个名为“Ezflix”的库,用于流式传输torrent视频。 It runs properly on command line interface but does not work when I run it on python idle.它在命令行界面上正常运行,但当我在 python idle 上运行它时不起作用。
I know that command line commands cant be used in idle but I just wish to find if there is any possibility or any hack to make it run on idle.我知道命令行命令不能在空闲状态下使用,但我只想找到是否有任何可能性或任何黑客可以让它在空闲状态下运行。
According to https://pypi.org/project/ezflix/ , ezflix
is a "command line utility", one which happens to be written in Python.根据https://pypi.org/project/ezflix/ , ezflix
是一个“命令行实用程序”,恰好是用 Python 编写的。 At this level, it is intended to be run from a command line terminal/console.在此级别,它旨在从命令行终端/控制台运行。
Such a program, even if written in python, might not be a Python library module, meaning that it is not intended that you import it and directly access its functions.这样的程序,即使是用 Python 编写的,也可能不是 Python库模块,这意味着您不打算导入它并直接访问其功能。 If this is true, it would not have a supported and documented application program interface (API).如果这是真的,它就没有支持和记录的应用程序接口 (API)。 If so, one could read the code and import it anyway, but the private internal objects and names might change from version to version.如果是这样,人们仍然可以阅读代码并导入它,但是私有内部对象和名称可能会因版本而异。 So the best way to access it from a Python program would be to run it separately, for instance, with subprocess, as suggested in the comments.因此,从 Python 程序访问它的最佳方法是单独运行它,例如,如评论中所建议的,使用子进程。
It turns out the ezflix does have a documented API and so it is also a library module.事实证明,ezflix确实有一个文档化的 API,因此它也是一个库模块。 The is briefly described at the bottom of the pypi page linked above.在上面链接的 pypi 页面底部简要描述了这一点。
from ezflix import Ezflix
ez = Ezflix(<arguments>)
...
I presume that the package itself contains more information on its usage.我认为包本身包含有关其用法的更多信息。
None of the above has anything to do with whether you run your program directly with python or with IDLE or with any other IDE.以上都不是有什么关系,你是否直接与Python或闲置或与任何其他IDE运行程序。 What could matter is whether the ezflix user interface specifically requires that it be run connected to the system terminal/console.重要的是 ezflix 用户界面是否特别要求它连接到系统终端/控制台运行。 Noting I saw on its pypi page suggests this.注意到我在它的 pypi 页面上看到了这一点。 It might also be that the movie player window somehow interferes with the IDLE GUI window, but I also do not expect this.也可能是电影播放器窗口以某种方式干扰了 IDLE GUI 窗口,但我也不指望这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.