You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在macOS Sequoia中通过Python挂载Windows共享文件夹失败的问题求助

在macOS Sequoia中通过Python挂载Windows共享文件夹失败的问题求助

大家好,我现在遇到个棘手的问题,想请各位帮忙分析下:我在macOS Sequoia系统上,尝试用Python代码挂载Windows Server 2022的共享文件夹,结果一直失败,实在摸不着头绪,来求助啦!

先交代下我的环境:macOS Sequoia、Windows Server 2022、VSCode、Python 3.12.6

这是我写的代码:

from contextlib import contextmanager
import os
import shutil
import subprocess

remote_share = '//user:password@10.0.0.100/remote_share_folder'
local_folder = 'local_folder'

@contextmanager
def mounted():
    retcode = subprocess.call(['/sbin/mount_smbfs',  remote_share, local_folder])
    if retcode != 0:
        raise OSError("mount operation failed")

try:
    with mounted():
        shutil.copy(os.path.join(remote_share, 'textfile.txt'), local_folder)
except OSError as e:
    print(f"Error: {e}")

运行后弹出的错误提示是:

Error: mount operation failed
mount_smbfs: server connection failed: No route to host

我已经简单检查过网络连接,但还是没找到问题根源,有没有大佬能给点排查方向或者修复建议呀?

备注:内容来源于stack exchange,提问作者fip

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 16:43:01