【发布时间】:2011-05-30 10:36:09
【问题描述】:
我的公司使用某种版本控制存档工具(Microsoft Windows),我想从中直接导入。但我找不到这样做的方法。
这是我尝试过的:
>>> import sys
>>> sys.path.append(r"http://some_path_copied_and_pasted/05.Autres%20Outils/Regen_Engine")
>>> sys.path
['C:\\Python26\\Lib\\idlelib', 'C:\\Python26\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\Python26\\lib', 'C:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\Python26\\lib\\site-packages', 'http://some_path_copied_and_pasted/05.Autres%20Outils/Regen_Engine']
>>> import regen_engine as r
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import regen_engine as r
ImportError: No module named regen_engine
我尝试将 URL 的“%20”替换为“”(空格),但结果是一样的。我也尝试过使用imp 模块,但没有更好的。
所以这是我的问题:
- 是否可以从 URL 进行导入?
- 如果是,我该如何实现?
也许一种解决方案是使用 Sharepoint 的其他隐藏路径访问此文件,因此为它添加一个标签是合适的。
【问题讨论】:
-
千万不要尝试,但是看看 xhtmlhook:boddie.org.uk/python/xhtmlhook
-
据我了解,这似乎与用于文档目的的 xhtml 更相关。我的意思是,Sharepoint 作为一个 Web 门户可见,但我仍然可以通过在具有完整 URL 的 Web 浏览器中直接访问来找到我的 python 脚本。
标签: python sharepoint import