NetLogo / NetLogo

turtles, patches, and links for kids, teachers, and scientists
http://ccl.northwestern.edu/netlogo/
1.02k stars 246 forks source link

Problem with recreating a table object when using import-world #1914

Closed ruthmore closed 3 years ago

ruthmore commented 3 years ago

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: Error reading extension object TABLE: 2: [["state intervention" 0] ["redistribution" 1] ["public services vs taxes" 2] ["immigration" 3] ["environment" 4] ["deregulation" 0] ["corruption" -1] ["anti-elite rhetoric" -1] ["urban vs rural" -1] ["nationalism" 6] ["social lifestyle" 5] ["tie: deregulation and nationalism" 6] ["civil liberties vs. law and order" 6]] ==> Closing double quote is missing at org.nlogo.workspace.ExtensionManager.$anonfun$readExtensionObject$1(ExtensionManager.scala:223) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237) at scala.collection.immutable.List.foreach(List.scala:392) at scala.collection.TraversableLike.map(TraversableLike.scala:237) at scala.collection.TraversableLike.map$(TraversableLike.scala:230) at scala.collection.immutable.List.map(List.scala:298) at org.nlogo.workspace.ExtensionManager.readExtensionObject(ExtensionManager.scala:228) at org.nlogo.nvm.ImportHandler.parseExtensionLiteral(ImportHandler.scala:15) at org.nlogo.parse.LiteralParser.readLiteralPrefix(LiteralParser.scala:63) at org.nlogo.parse.LiteralParser.getLiteralValue(LiteralParser.scala:33) at org.nlogo.parse.CompilerUtilities$.$anonfun$readFromString$6(CompilerUtilities.scala:28) at org.nlogo.parse.CompilerUtilities$.$anonfun$numberOrElse$1(CompilerUtilities.scala:37) at scala.util.Either$RightProjection.getOrElse(Either.scala:665) at org.nlogo.parse.CompilerUtilities$.numberOrElse(CompilerUtilities.scala:36) at org.nlogo.parse.CompilerUtilities$.readFromString(CompilerUtilities.scala:28) at org.nlogo.compile.Compiler.readFromString(Compiler.scala:139) at org.nlogo.workspace.Evaluator.readFromString(Evaluator.scala:168) at org.nlogo.workspace.Evaluating.readFromString(Evaluating.scala:65) at org.nlogo.workspace.Evaluating.readFromString$(Evaluating.scala:64) at org.nlogo.workspace.AbstractWorkspaceScala.readFromString(AbstractWorkspaceScala.scala:26) at org.nlogo.workspace.ExtensionManager.readFromString(ExtensionManager.scala:207) at org.nlogo.extensions.table.TableExtension.importWorld(TableExtension.java:179) at org.nlogo.workspace.ExtensionManager.importExtensionData(ExtensionManager.scala:360) at org.nlogo.workspace.AbstractWorkspace.importExtensionData(AbstractWorkspace.java:75) at org.nlogo.agent.ImporterJ.importExtensionData(ImporterJ.java:267) at org.nlogo.agent.ImporterJ.importWorld(ImporterJ.java:169) at org.nlogo.agent.World2D.importWorld(World.scala:191) at org.nlogo.workspace.AbstractWorkspace$1.doImport(AbstractWorkspace.java:269) at org.nlogo.workspace.AbstractWorkspace.doImport(AbstractWorkspace.java:328) at org.nlogo.workspace.AbstractWorkspace.importWorld(AbstractWorkspace.java:264) at org.nlogo.window.GUIWorkspace.importWorld(GUIWorkspace.java:185) at org.nlogo.prim.etc._importworld$1.run(_importworld.java:27) at org.nlogo.window.ThreadUtils$.$anonfun$waitFor$2(ThreadUtils.scala:29) at org.nlogo.window.ThreadUtils$$anon$2.run(ThreadUtils.scala:24) at org.nlogo.window.ThreadUtils$$anon$2.run(ThreadUtils.scala:23) at org.nlogo.window.ThreadUtils$$anon$3.run(ThreadUtils.scala:49) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

NetLogo 6.1.1 main: org.nlogo.app.AppFrame thread: JobThread Java HotSpot(TM) 64-Bit Server VM 1.8.0_202 (Oracle Corporation; 1.8.0_202-b08) operating system: Windows 10 10.0 (amd64 processor) Scala version 2.12.8 JOGL: (3D View not initialized) OpenGL Graphics: (3D View not initialized) model: PaCE_Austria_v1.1.6

03:26:42.631 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:42.626 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:37.160 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:37.147 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0 03:26:37.052 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$1 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0


I use "export-world" at the end of setup to save the initial state of the simulation. Then I can go back to it (using "import-world") to run a different scenario from the exact same state. The world file looks fine to me, there don't seem to be any missing double quotes. Have attached the .csv file renamed as .txt. model-state-0.txt.

Same error happens in NetLogo 6.2.

brandesNW commented 3 years ago

Hi Ruth, I am looking into your problem. I’ve found that recreating a table object when using import-world is possible with a simple table. Would it be possible for you to send me the model from which you did the export world? That would help with the debugging. If it wouldn’t be too much work it would be great if you could create a smaller model that reproduces the problem. Smaller could mean fewer of any of the following: turtles, links, patches.

To share a .nlogo model file please include it in a zip file or change the extension because your reply is handled by a github program that accepts only the following attachment formats: PNG (.png) GIF (.gif) JPEG (.jpg) Log files (.log) Microsoft Word (.docx), Powerpoint (.pptx), and Excel (.xlsx) documents. Text files (.txt) PDFs (.pdf) ZIP (.zip, .gz)

Thanks, Aaron

Aaron Brandes, Software Developer Center for Connected Learning and Computer-Based Modeling

From: Ruth Meyer @.> Reply-To: NetLogo/NetLogo @.> Date: Thursday, April 8, 2021 at 11:10 AM To: NetLogo/NetLogo @.> Cc: Subscribed @.> Subject: [NetLogo/NetLogo] Problem with recreating a table object when using import-world (#1914)

NetLogo is unable to supply you with more details about this error. Please report the problem at https://github.com/NetLogo/NetLogo/issueshttps://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues__;!!Dq0X2DkFhyF93HkjWTBQKhk!GZY1lfRp627jaBMZIuhn0Q4eJ0dPwoJH_xfiezMj0GnFJOQi1AjXF-UOsaXBJvh13ftrr3evmw$, or to @.**@.>, and paste the contents of this window into your report.

java.lang.IllegalStateException: Error reading extension object TABLE: 2: [["state intervention" 0] ["redistribution" 1] ["public services vs taxes" 2] ["immigration" 3] ["environment" 4] ["deregulation" 0] ["corruption" -1] ["anti-elite rhetoric" -1] ["urban vs rural" -1] ["nationalism" 6] ["social lifestyle" 5] ["tie: deregulation and nationalism" 6] ["civil liberties vs. law and order" 6]] ==> Closing double quote is missing at org.nlogo.workspace.ExtensionManager.$anonfun$readExtensionObject$1(ExtensionManager.scala:223) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237) at scala.collection.immutable.List.foreach(List.scala:392) at scala.collection.TraversableLike.map(TraversableLike.scala:237) at scala.collection.TraversableLike.map$(TraversableLike.scala:230) at scala.collection.immutable.List.map(List.scala:298) at org.nlogo.workspace.ExtensionManager.readExtensionObject(ExtensionManager.scala:228) at org.nlogo.nvm.ImportHandler.parseExtensionLiteral(ImportHandler.scala:15) at org.nlogo.parse.LiteralParser.readLiteralPrefix(LiteralParser.scala:63) at org.nlogo.parse.LiteralParser.getLiteralValue(LiteralParser.scala:33) at org.nlogo.parse.CompilerUtilities$.$anonfun$readFromString$6(CompilerUtilities.scala:28) at org.nlogo.parse.CompilerUtilities$.$anonfun$numberOrElse$1(CompilerUtilities.scala:37) at scala.util.Either$RightProjection.getOrElse(Either.scala:665) at org.nlogo.parse.CompilerUtilities$.numberOrElse(CompilerUtilities.scala:36) at org.nlogo.parse.CompilerUtilities$.readFromString(CompilerUtilities.scala:28) at org.nlogo.compile.Compiler.readFromString(Compiler.scala:139) at org.nlogo.workspace.Evaluator.readFromString(Evaluator.scala:168) at org.nlogo.workspace.Evaluating.readFromString(Evaluating.scala:65) at org.nlogo.workspace.Evaluating.readFromString$(Evaluating.scala:64) at org.nlogo.workspace.AbstractWorkspaceScala.readFromString(AbstractWorkspaceScala.scala:26) at org.nlogo.workspace.ExtensionManager.readFromString(ExtensionManager.scala:207) at org.nlogo.extensions.table.TableExtension.importWorld(TableExtension.java:179) at org.nlogo.workspace.ExtensionManager.importExtensionData(ExtensionManager.scala:360) at org.nlogo.workspace.AbstractWorkspace.importExtensionData(AbstractWorkspace.java:75) at org.nlogo.agent.ImporterJ.importExtensionData(ImporterJ.java:267) at org.nlogo.agent.ImporterJ.importWorld(ImporterJ.java:169) at org.nlogo.agent.World2D.importWorld(World.scala:191) at org.nlogo.workspace.AbstractWorkspace$1.doImport(AbstractWorkspace.java:269) at org.nlogo.workspace.AbstractWorkspace.doImport(AbstractWorkspace.java:328) at org.nlogo.workspace.AbstractWorkspace.importWorld(AbstractWorkspace.java:264) at org.nlogo.window.GUIWorkspace.importWorld(GUIWorkspace.java:185) at org.nlogo.prim.etc._importworld$1.run(_importworld.java:27) at org.nlogo.window.ThreadUtils$.$anonfun$waitFor$2(ThreadUtils.scala:29) at org.nlogo.window.ThreadUtils$$anon$2.run(ThreadUtils.scala:24) at org.nlogo.window.ThreadUtils$$anon$2.run(ThreadUtils.scala:23) at org.nlogo.window.ThreadUtils$$anon$3.run(ThreadUtils.scala:49) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

NetLogo 6.1.1 main: org.nlogo.app.AppFrame thread: JobThread Java HotSpot(TM) 64-Bit Server VM 1.8.0_202 (Oracle Corporation; 1.8.0_202-b08) operating system: Windows 10 10.0 (amd64 processor) Scala version 2.12.8 JOGL: (3D View not initialized) OpenGL Graphics: (3D View not initialized) model: PaCE_Austria_v1.1.6

03:26:42.631 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:42.626 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:37.160 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0 03:26:37.147 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0 03:26:37.052 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$1 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0 03:26:37.035 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0


I use "export-world" at the end of setup to save the initial state of the simulation. Then I can go back to it (using "import-world") to run a different scenario from the exact same state. The world file looks fine to me, there don't seem to be any missing double quotes. Have attached the .csv file renamed as .txt. model-state-0.txthttps://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/files/6279433/model-state-0.txt__;!!Dq0X2DkFhyF93HkjWTBQKhk!GZY1lfRp627jaBMZIuhn0Q4eJ0dPwoJH_xfiezMj0GnFJOQi1AjXF-UOsaXBJvh13fskxzLcNA$.

Same error happens in NetLogo 6.2.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues/1914__;!!Dq0X2DkFhyF93HkjWTBQKhk!GZY1lfRp627jaBMZIuhn0Q4eJ0dPwoJH_xfiezMj0GnFJOQi1AjXF-UOsaXBJvh13fvfVCj7PA$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANSUO2RMTC7FXFYHVFYGAZTTHXBMBANCNFSM42TC3UOA__;!!Dq0X2DkFhyF93HkjWTBQKhk!GZY1lfRp627jaBMZIuhn0Q4eJ0dPwoJH_xfiezMj0GnFJOQi1AjXF-UOsaXBJvh13fvIddLHTw$.

ruthmore commented 3 years ago

Hi Aaron,

Thanks for looking into this. I have produced a slightly smaller version of the model that only has 2 parties and 100 voter agents and doesn't use any input files to initialise parties and voters, but is still working. I hope this is manageable for you. The problem with the table in import-world still persists.

I've renamed the model from .nlogo to .txt to be able to attach it here.

Cheers, Ruth PACE_Austria_v.TEST.txt

brandesNW commented 3 years ago

Hi Ruth, Your example was sufficient for me to analyze the problem and come up with a solution.

Your code actually touches two underlying bugs. Bug 1: export of a table will fail if a key contains a “:” – this is a newly discovered issue You need to change the following line table:put party-mip-map "tie: deregulation and nationalism" 6 for example this would work table:put party-mip-map "tied deregulation and nationalism" 6

Fixing Bug 1 uncovered an instance of known bug Bug 2: can't import world containing nested arrays or tables #12https://github.com/NetLogo/NetLogo/issues/12 You are using an array of arrays as a two-dimensional array. In order to export and import your data you need to use the matrix extensionhttps://ccl.northwestern.edu/netlogo/docs/matrix.html instead. This will require some recoding, but should be straight forward. All lines using array: commands used to construct the voters-own variable my-opinions will need to be replaced with lines that use the matrix: commands. A benefit is that the code will be more readable. The matrix extension requires the data to be numeric, which is not a limitation for your current model.

The matrix commands you will most likely need are in the categories Matrix creation and conversion to/from lists and Matrix data retrieval and manipulation If you encounter any difficulties with the matrix extension, I suggest posting to the NetLogo Users Grouphttps://groups.google.com/d/forum/netlogo-users

Your model looks very interesting and I wish you success continuing to develop it. Cheers, Aaron

-- Aaron Brandes, Software Developer Center for Connected Learning and Computer-Based Modeling

From: Ruth Meyer @.> Reply-To: NetLogo/NetLogo @.> Date: Tuesday, April 13, 2021 at 12:15 PM To: NetLogo/NetLogo @.> Cc: Aaron Andre Brandes @.>, Comment @.***> Subject: Re: [NetLogo/NetLogo] Problem with recreating a table object when using import-world (#1914)

Hi Aaron,

Thanks for looking into this. I have produced a slightly smaller version of the model that only has 2 parties and 100 voter agents and doesn't use any input files to initialise parties and voters, but is still working. I hope this is manageable for you. The problem with the table in import-world still persists.

I've renamed the model from .nlogo to .txt to be able to attach it here.

Cheers, Ruth PACE_Austria_v.TEST.txthttps://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/files/6305182/PACE_Austria_v.TEST.txt__;!!Dq0X2DkFhyF93HkjWTBQKhk!BJe-O4FUocbvbnks-3xkJb-Yy3P0JI9IY1RFt3748rOhvlmE8dSA8ibL-fe0Kv9sHzYUa3aFIA$

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues/1914*issuecomment-818862236__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!BJe-O4FUocbvbnks-3xkJb-Yy3P0JI9IY1RFt3748rOhvlmE8dSA8ibL-fe0Kv9sHzZAUCxVjQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANSUO2TEQ75OSX527VMOS5LTIRUXZANCNFSM42TC3UOA__;!!Dq0X2DkFhyF93HkjWTBQKhk!BJe-O4FUocbvbnks-3xkJb-Yy3P0JI9IY1RFt3748rOhvlmE8dSA8ibL-fe0Kv9sHzYBUMfAVQ$.

brandesNW commented 3 years ago

The user can get the model to work by

  1. Changing a table key so that it no longer contains a “:”
  2. Using the matrix extension, rather than the array extension to create a two-dimensional array.

Closing this bug as the underlying problems are now covered by the following bugs:

import of a table will fail if a key contains a “:” #1916 can't import world containing nested arrays or tables #12

ruthmore commented 3 years ago

Thanks, Aaron! That's some great detective work. I will follow your suggestions, even though that means I will have to change the empirical data specificying the parties. That's where the ":" comes from.

Cheers, Ruth

UriCCL commented 3 years ago

Hi Aaron,

I see a lot of your emails are going through git and not to one of our mailing lists. That is problematic for me in 2 ways:

• No matter what I do, all such messages go to spam, so I dont usually see them till quite late. • More importantly, ALL CCL messages must be cc’ed to a ccl mailing list.

Please take note.

—Uri

Uri Wilensky Lorraine H. Morton chaired Professor Professor of Learning Sciences, Computer Science and Complex Systems Director, Center for Connected Learning and Computer-Based Modeling (CCL) Northwestern University

On Apr 14, 2021, at 2:51 PM, brandesNW @.***> wrote:

The user can get the model to work by

Changing a table key so that it no longer contains a “:” Using the matrix extension, rather than the array extension to create a two-dimensional array. Closing this bug as the underlying problems are now covered by the following bugs:

import of a table will fail if a key contains a “:” #1916 https://urldefense.com/v3/__https://github.com/NetLogo/NetLogo/issues/1916__;!!Dq0X2DkFhyF93HkjWTBQKhk!EojxMK-dfz3_I5ZP7f8Hy4Pm2IrNbzjAFjpEzPR8usYFYPAJfvW4H5GQHkT06Plf0w$ can't import world containing nested arrays or tables #12 https://urldefense.com/v3/__https://github.com/NetLogo/NetLogo/issues/12__;!!Dq0X2DkFhyF93HkjWTBQKhk!EojxMK-dfz3_I5ZP7f8Hy4Pm2IrNbzjAFjpEzPR8usYFYPAJfvW4H5GQHkRWZlz0KA$ — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/NetLogo/NetLogo/issues/1914*issuecomment-819789326__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!EojxMK-dfz3_I5ZP7f8Hy4Pm2IrNbzjAFjpEzPR8usYFYPAJfvW4H5GQHkTIyYbOHA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABRSBQL2ZA7YYHE46DXEGILTIXW5BANCNFSM42TC3UOA__;!!Dq0X2DkFhyF93HkjWTBQKhk!EojxMK-dfz3_I5ZP7f8Hy4Pm2IrNbzjAFjpEzPR8usYFYPAJfvW4H5GQHkQ485hQ5w$.