Python/Visum错误消息

嗨,如果有人能帮我解读这份来自Python的异常报告,我将不胜感激。我所要做的就是打电话给Visum,带上一个流动包。我认为问题可能出在Python安装上,而不是脚本上。
多谢,
斯蒂芬
我有以下代码:

选择 | 换行 | 行号
  1. import VisumPy.helpers
  2. #from VisumPy.helpers import CreateVisum
  3.  
  4. Visum = VisumPy.helpers.CreateVisum(115)
  5. fileNames = ["Base06_AM_DS"]
  6.  
  7. for fileName in fileNames: 
  8.     Visum.LoadVersion(r"Y:/07 Forecasting/10 Review of Highway Model/Test/" + fileName)
  9.  
  10. #flow bundle execute and save matrix
  11.  
  12. fn = 119545498
  13. tn = 119545499
  14.  
  15. # UC1
  16. dseg = "UC1"
  17. filename = "Y:/07 Forecasting/10 Review of Highway Model/Test/AA16DS_AM_SLA1_NB_UC1_F.mtx"
  18. netElem = Visum.CreateNetElements()
  19. link = Visum.Net.Links.ItemByKey(fn, tn)
  20. netElem.add(link)
  21. fb = Visum.Net.DemandSegments.ItemByKey(dseg).FlowBundle
  22. fb.Execute(netElem)
  23. fb.Save(filename,"O") 
  24.  
  25. #   Visum.Procedures.Execute()
  26. Visum.SaveVersion(r"Y:/07 Forecasting/10 Review of Highway Model/Test/" + fileName) 

然后,我收到了以下错误消息:
运行脚本中的文件"C:\Python25\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",第309行
DEBUGGER.RUN(代码对象,__Main__.__dict__,Start_Steping=0)
文件"C:\Python25\Lib\site-packages\Pythonwin\pywin\debugger\__init__.py",第60行,在运行中
_GetCurrentDebugger().run(cmd,global als,local als,Start_Steping)
运行中的文件"C:\Python25\Lib\site-packages\Pythonwin\pywin\debugger\debugger.py",第624行
全球、本地人的执行命令
文件"Y:\07 Forecast\10审查公路模型\测试\Oa_Original_SLA.py",第21行,中
NetElem.add(链接)
文件"C:\Python25\lib\site-packages\win32com\client\__init__.py",第454行,位于__getattr__
引发AttributeError,"'%s'对象没有属性'%s'"%(epr(Self),attr)
AttributeError:''对象没有属性'Add'
>>>

# 回答1


我找不到关于这个模块的文档,所以我不确定发生了什么。(PTV.de?我的德语不够好,无法判断该站点是否相关)
您可以做的是打开一个python窗口并逐行运行该程序,直到您到达

选择 | 换行 | 行号
  1. netElem = Visum.CreateNetElements()

然后运行:

选择 | 换行 | 行号
  1. dir(netElem)

看看会发生什么。错误似乎是关于它没有.add(),我想如果它看起来很奇怪,那么模块可能已经损坏或什么的。

标签: python

添加新评论