相关疑难解决方法(0)

从python中的网络驱动器号获取完整的计算机名称

我使用python来填充一个表,其中包含许多存储文件的文件路径.但是,该路径需要具有完整的网络驱动器计算机名称,而不仅仅是驱动器号,即

//计算机名/文件夹/子文件夹/文件

病人:/文件夹/子文件夹/文件

我已经使用win32api,win32file和os.path模块进行了调查,但没有任何东西看起来像它能够做到这一点.我需要类似win32api.GetComputerName()的功能,但能够将已知的驱动器号作为参数放入,并返回映射到该字母的计算机名称.

那么在python中是否有查找驱动器号并取回计算机名称?

python windows network-drive computer-name

7
推荐指数
3
解决办法
2002
查看次数

pyinstaller 在程序内找不到文件路径

我创建了一个测试工具来检查是否有任何模块无法与 pyinstaller 一起使用,以便我可以在主程序上使用 pyinstaller 之前解决它们。

当我尝试与脚本中的文件路径交互时,pyinstaller 创建的程序似乎找不到我尝试硬编码到脚本中的路径,例如“Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test” .psd”。我决定使用简单的 os.path.exists() 来调试这个谜团,但没有运气。当我从 python 控制台运行调试程序时,它工作得很好,那么这里出了什么问题呢?

我如何生成exe:pyinstaller“Z:\ mkb \programing \ python \ util \ pyinstaller_library_tester.py”

Python版本:2.7.15 PyInstaller版本:3.3.1

领事输出:

Testing: Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z:\\mkb\\crew\\mark_conrad\\pictures\\psd_tool_test_files\\test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z:/mkb/crew/mark_conrad/pictures/psd_tool_test_files/test.psd
>>> This path does not exsist.
Path Results: False

Testing: Z://mkb//crew//mark_conrad//pictures//psd_tool_test_files//test.psd
>>> This path does not exsist.
Path Results: False
Run Code Online (Sandbox Code Playgroud)

调试程序代码:

def checkingPaths(path,btn):
    import os

    if os.path.exists(path):
        print '>>> Found a working …
Run Code Online (Sandbox Code Playgroud)

python pyinstaller python-2.7

1
推荐指数
1
解决办法
6049
查看次数