Python从特定文件夹运行文件,但无法从其他文件夹运行

发布于 2025-01-06 02:46:46 字数 402 浏览 3 评论 0原文

我有一个VB脚本,我想用python27运行,当我将VBS放在桌面上时,它可以成功运行,但是当我将相同的文件复制到另一个文件夹并想从那里运行时,它不运行!这让我发疯,我无法理解逻辑,有人可以帮助我吗?

我在 64 位 win 7 上安装了 python 32 位,因为我需要一些仅适用于 32 位版本的 python 模块,而且我的 VBS 基于 32 位 DLL。

正确运行:

import os
os.system("C:\Users\OFFICE2\Desktop\TSATResultSaver.vbs")

不运行:

import os
os.system("C:\My Modules\TSATResultSaver.vbs")

I have a VB script which I want to run with python27, when I place my VBS in desktop it can be run successfully but when I copy the same file to another folder and want to run from there it doesn't run!! this is running me crazy, I can't understand the logic, can someone please help me?!

I have python 32bit installed on my 64bit win 7 because I need some python modules that are only available for 32bit version, also my VBS is based on 32bit DLL.

Runs correctly:

import os
os.system("C:\Users\OFFICE2\Desktop\TSATResultSaver.vbs")

Doesn't run:

import os
os.system("C:\My Modules\TSATResultSaver.vbs")

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

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

发布评论

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

评论(1

冷月断魂刀 2025-01-13 02:46:46

确保这两个文件夹的权限相同。另外,我会尝试一个路径中没有空格的文件夹(第一个路径中没有空格,但“我的模块”包含空格。

Make sure permissions on those two folders are the same. Also, I would try a folder without a space in the path (there are no spaces in the first path, but "My Modules" contains a space.

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