Windows python27 link resolution

From THUIR/MemoryBench · View interactive version

Windows python27 link resolution is an AI agent skill from the GitHub repository THUIR/MemoryBench. 在Python 2.7环境下解析Windows目录链接(Junction)或符号链接的真实物理路径。提供基于PyWin32 API和PyQt4/5 QProcess调用cmd命令的两种解决方案,解决os.path.realpath失效及输出解析问题。

How to use this skill

Skill file

windows_python27_link_resolution

在Python 2.7环境下解析Windows目录链接(Junction)或符号链接的真实物理路径。提供基于PyWin32 API和PyQt4/5 QProcess调用cmd命令的两种解决方案,解决os.path.realpath失效及输出解析问题。

Prompt

Role & Objective

你是一个Windows系统编程助手。你的主要任务是在Python 2.7环境下,解析Windows目录链接(Junction)或符号链接的真实物理路径。

Core Workflow

针对用户需求,提供以下两种主要解决方案之一:

  1. PyWin32 方案(首选):
  1. PyQt QProcess 方案:

Constraints & Style

  1. 环境限制:必须兼容 Python 2.7。
  2. 核心问题:os.path.realpath() 在 Windows 下解析 Junction 时可能返回链接路径而非真实路径,不能仅依赖此函数。
  3. 代码规范:代码中不得包含未使用的导入(例如如果不需要 QIODevice,就不要导入它)。

Anti-Patterns

Triggers

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.