命名电影输出文件时出现奇怪的错误

时间:2015-02-14 14:37:13

标签: netlogo

我似乎无法得到错误原因。

工作代码:

print word "output" date-and-time
movie-start "output"

不工作代码:

movie-start word "output" date-and-time

错误:

error (IllegalStateException)
 while observer running MOVIE-START
  called by procedure GO
  called by Button 'go'

NetLogo is unable to supply you with more details about this error.  Please report the problem
at https://github.com/NetLogo/NetLogo/issues, or to bugs@ccl.northwestern.edu, and paste the
contents of this window into your report.

java.lang.IllegalStateException: java.io.IOException: The filename, directory name or volume label syntax is incorrect
 at org.nlogo.workspace.DefaultFileManager.relativeToAbsolute(DefaultFileManager.java:126)
 at org.nlogo.workspace.DefaultFileManager.attachPrefix(DefaultFileManager.java:115)
 at org.nlogo.prim.gui._moviestart.perform(_moviestart.scala:15)
 at org.nlogo.nvm.Context.stepConcurrent(Context.java:91)
 at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.java:82)
 at org.nlogo.job.JobThread.org$nlogo$job$JobThread$$runPrimaryJobs(JobThread.scala:143)
 at org.nlogo.job.JobThread$$anonfun$run$1.apply$mcV$sp(JobThread.scala:78)
 at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
 at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
 at scala.util.control.Exception$Catch.apply(Exception.scala:88)
 at org.nlogo.util.Exceptions$.handling(Exceptions.scala:41)
 at org.nlogo.job.JobThread.run(JobThread.scala:75)
Caused by: java.io.IOException: The filename, directory name or volume label syntax is incorrect
 at java.io.WinNTFileSystem.canonicalize0(Native Method)
 at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
 at java.io.File.getCanonicalPath(File.java:559)
 at org.nlogo.workspace.DefaultFileManager.relativeToAbsolute(DefaultFileManager.java:123)
 ... 11 more

NetLogo 5.1.0
main: org.nlogo.app.AppFrame
thread: JobThread
Java HotSpot(TM) Server VM 1.6.0_45 (Sun Microsystems Inc.; 1.6.0_45-b06)
operating system: Windows 8 6.2 (x86 processor)
Scala version 2.9.2
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: 70p

08:03:04.655 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0
08:03:04.622 RuntimeErrorEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
08:03:04.622 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0

1 个答案:

答案 0 :(得分:3)

可能是错误

  

文件名,目录名或卷标语法不正确

是因为文件系统禁止文件名中的:等字符。代码中的文件名表达式:word "output" date-and-time产生类似

的内容
output11:22:04.548 PM 14-feb-2015

根据user manual,格式是固定的,因此子字符串可以提供帮助:

let dt date-and-time  
let fname ( word "output" substring dt 0 2 substring dt 3 5 substring dt 7 26) 
movie-start fname