在一个非常特定的应用程序上从 firefox 执行 python 脚本,只是为了让 firefox 提供图形 IDE

发布于 2024-12-04 17:33:11 字数 674 浏览 2 评论 0原文

所以,我已经搜索这个话题很长一段时间了,但我无法确定它是否可能。我怀疑不是,但我需要确定。

我在做什么: 我正在构建一个使用 xml、xsl 和 javascript 的精美 Web 应用程序。但是,我需要对文本文件进行一些转换,以将其转换为正确的 xml 文件。为此,我使用 python 脚本。

我需要什么: 我正在努力使应用程序的使用尽可能简单,但是当用户必须在执行任何操作之前执行终端脚本时,这会被破坏。我需要一个用于 python 的图形 IDE,但我只是没有时间学习如何制作一个,而且我希望整个应用程序能够在同一个 Web 环境中运行,对用户来说更加直观。然后,一个非常简单的方法是使用 Firefox 作为 IDE,例如选择要通过它转换的文件,然后从那里启动 python 脚本。

我的要求: 我只需要与 Firefox 兼容。当然,任何能够安装 Python 和 Firefox 的系统都应该可以工作。只要用户对应用程序感兴趣,他们就会很乐意安装这两个程序。

我不知道的是: 是否可以执行外部 python 脚本?如果不是,出于安全原因我想,用户有什么办法允许它吗?也许通过安装插件?

谢谢!

杰拉德

So, I've been searching the topic for quite a while, but I am unable to find out whether it is possible or not. I suspect not, but I need to be sure.

What I'm doing:
I am building a fancy web app that uses xml, xsl and javascript. However, I need to do some transformation to a text file to convert it into a proper xml file. To do this, I use a python script.

What I need:
I am working to make as easy as possible the use of the app, but this gets kind of destroyed when the user has to execute a terminal script before anything. I need a graphical IDE for python, but I just don't have time to learn how to make one, and I would love that the entire app would work within the same web environment, much more intuitive for the user. Then, a really easy way to do that would be to use Firefox as the IDE, for example choosing the file to be transformed through it, and launching from there the python script.

What I require:
I need compatibility only with Firefox. But of course any system capable to install Python and Firefox should work as well. The user would happily install both programs, as long as they have interest in the app.

What I don't know:
Is that possible, to execute an external python script? If not, for security reasons I imagine, is there any way for the user to allow it? Maybe through the installation of a plugin?

Thanks!

Gerard

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忆离笙 2024-12-11 17:33:11

是的,可以执行外部 python 脚本。您可以使用 simpleServer (示例),从您的页面接收(Ajax)请求并调用 示例)。 html” rel="nofollow">subprocess 或 os.startfile 来启动脚本。事实上,您可以从服务器内部调用函数本身并返回结果(例如 json) 到页面并使用您的 javascript 来处理它。

Yes, It is possible to execute an external python script. You can use a simpleServer (example) that receives a (Ajax) request from your page and calls a subprocess or os.startfile to launch the script. In fact, you can call the function itself from within the server and return the result (e.g. as json) to the page and use your javascript to handle it.

寻梦旅人 2024-12-11 17:33:11

如果您在firefox中实际使用python,而不是用python编写服务器端(尽管网络服务器当然可以在本地运行),我猜pythonext (曾经是 pyxpcomext)是什么你需要。

If you're after actually using python in firefox, rather than having the server side written in python (although the webserver can of course be running locally), I would guess pythonext (used to be pyxpcomext) is what you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文