Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Share Objects (http://www.alice.org/community/forumdisplay.php?f=8)
-   -   File I/O Tool (http://www.alice.org/community/showthread.php?t=6758)

DensetsuNoKaboom 06-17-2011 06:45 AM

[QUOTE=arty-fishL;37631]
If you want a new line at any time just add in [I]\n[/I] .
[/QUOTE]

Add it in where?

arty-fishL 06-17-2011 08:05 AM

Wherever you're writing just add [I]\n[/I] into the string for a new line. For example:

"hi there \n my name is Bob\nGreat!"

would produce

[CODE]hi there
my name is Bob
Great![/CODE]

Anyway, what you were looking for was writing to line 0, not line 1.

I could maybe update it to change writing line 0 to line 1 instead (so the numbers are shifted down one) and so on. I could also add a function to create a new line or set of lines; one for changing a string to a number; maybe even also a variable saving function.

DensetsuNoKaboom 06-17-2011 08:46 PM

It failed as well when I tried writing to line 0.

arty-fishL 06-18-2011 04:14 AM

[QUOTE=DensetsuNoKaboom;37684]It failed as well when I tried writing to line 0.[/QUOTE]Ensure the file exists first - use new_file with overwrite set to false. If writing to line 0 doesn't work then try using write. It should work, I've tested it lots.

Dj Tech42 06-29-2011 03:06 PM

Is this compatible with Mac OS X? I recognized it started with C:// so I changed it to the Mac filepath and when I ran the world it threw an error:


Error during simulation.


Alice version: 2.2 09/10/2010

Throwable that caused the error:
Traceback (innermost last):
File "edu.cmu.cs.stage3.alice.core.property.ScriptProperty[name=script,owner=edu.cmu.cs.stage3.alice.core.response.ScriptResponse[world.iOTool.event.__Unnamed0__]]", line 1, in ?
File "<string>", line 26, in ?
File "<string>", line 12, in patchOS
IOError: File not found - jython-2.1\Lib\javaos.py (No such file or directory)

arty-fishL 06-29-2011 04:56 PM

[QUOTE=Dj Tech42;38233]Is this compatible with Mac OS X? I recognized it started with C:// so I changed it to the Mac filepath and when I ran the world it threw an error:


Error during simulation.


Alice version: 2.2 09/10/2010

Throwable that caused the error:
Traceback (innermost last):
File "edu.cmu.cs.stage3.alice.core.property.ScriptProperty[name=script,owner=edu.cmu.cs.stage3.alice.core.response.ScriptResponse[world.iOTool.event.__Unnamed0__]]", line 1, in ?
File "<string>", line 26, in ?
File "<string>", line 12, in patchOS
IOError: File not found - jython-2.1\Lib\javaos.py (No such file or directory)[/QUOTE]Ehh, sorry, it seems your version (either your version is broken or Mac version is broken) of Alice has its file directory incorrectly referenced. You could try updating Alice, there's a newer version of 2.2 available, but I'm not sure that will help.

Dj Tech42 06-29-2011 05:20 PM

I already have the latest version. I think it has something to do with the file system being different on Mac OS X. I think this is a very important feature that needs to be implemented into Alice and I am sad that it isn't working :(

Dj Tech42 06-29-2011 05:58 PM

Is there a way I can change how Alice accesses the internal files? It can't find one of its own files, which is really annoying

arty-fishL 06-29-2011 06:14 PM

[QUOTE=Dj Tech42;38237]I already have the latest version. I think it has something to do with the file system being different on Mac OS X. I think this is a very important feature that needs to be implemented into Alice and I am sad that it isn't working :([/QUOTE]Oh, the latest Windows version is a 2011 version, youve got a 2010 (maybe Mac isn't as updated yet).

[QUOTE=Dj Tech42;38238]Is there a way I can change how Alice accesses the internal files? It can't find one of its own files, which is really annoying[/QUOTE]Elaborate on this error, I may be able to help. What file cant it find?

Dj Tech42 06-29-2011 06:46 PM

/Applications/Alice 2.2.app/Contents/Required/jython-2.1/Lib/javaos.py

javaos.py is the file it is looking for, and I know where it is ^. Is there some way I can show Alice where to look for the file?

And the Mac version was released September 2010.


All times are GMT -5. The time now is 01:08 AM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.