got an odd problem- when I save and then reopen python scripts there seems to be some sort of carriage return/newline craziness- a typical script will give:

SyntaxError: (mismatched character \r expecting \n, (string, string line number, number on the line)

as a python error. Some scripts dont cause this, and some that I fix by hand, successfully run and then save do it all over again. My workflow is a bit messed as a result!

In other words- I will open a script, python will give me errors, I'll then fix those errors and the script will run. I then save the script, and the next time I open it the errors will have returned..?

linux linaro on an odroid

If I find the fix I will post it here, but any input super-welcome

SpenMarsden

10 years 8 months ago

hmmmmm

crazy, if I open a script in bluefish, fix and save it- then open in MRL it is mostly similar, but when I close MRL bluefish tells me the script has been modified- I reopen it to see vastly different formatting....maybe my OS is at fault..? 

if I open it in IDLE, i get

from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Servo
from org.myrobotlab.service import Runtime
from time import sleep
 
but when I open in MRL I get:
 
from org.myrobotlab.service import Arduinofrom org.myrobotlab.service importServofromorg.myrobotlab.service import Runtimefrom time import sleep
 
ay yi yi! Also, when I copy the paste from MRL into here(i.e. this forum comment) it is re-formatted correctly!
I'm off to dig some ground with a shovel to calm down.....:)

 

Yes...  this is an irritating bug !
OS is slightly involved, but not at fault... its an evil bug of the darkest order ! 
First I am impressed with your exploration skills, you are a courageous adventurer..  exploring all parts even mucky swamps

First the background :

1. The python editor is primarily a swing component called - RSyntaxTextArea.  It's an amazing editor from here http://fifesoft.com/rsyntaxtextarea/
2. It's a hidden swamp, in that (at least for me) it doesn't happen all the time - you'd think this would be a good thing, but it isn't.  If it happened all the time it would be a consistent problem - and they are usually easier to solve than disappearing swamps.
3. My gut feeling is that it's probably not RSyntaxTextArea bug, but the way I'm using it.

The stuff I've learned.
1. First their is the ancient and evil feud between the 2 worlds.  The PC versus Unix -  CR/LF vs LF ... Think of the millions and millions of casualties from this war.......   soooo sad.
2. MRL + RSyntaxTextArea + Bug = I believe a "mixture"    I think somehow an extra CR or a mixture of CR/LF and just LF is getting put in the file - then Python explodes :(
3. When I examine a bad file under textpad it says - encoding = ANSI and file type = "unknown"
4. When I converted the file to file type = Unix - it has (so far) been fine.
5. usually when you see something squished all on one line, its because your editor is expecting PC CR/LF and it's loaded a Unix formatted file.

I think I can re-create the problem by starting with a PC formatted file - loading it in MRL - quitting MRL (BTW - when you quit MRL tries to auto-save your Python file automatically, with the assumption you want to keep the latest contents from the editor.....

I'm off to do some experiments....  I'll keep you posted on my findings and hope to see what you discover !  Cheerio !

GroG

10 years 8 months ago

step 1 create a PC text file - add some lines of Python & load it in MRL

step 2 
Add a couple lines and close window.  File type becomes "unknown"

BOOOOM !


 

GroG

10 years 8 months ago

I'm gonna try the same experiment with a Unix formatted file ...

GroG

10 years 8 months ago

Start with Unix and all is well !
Tried the same experiment with a Unix formatted file ... no issue !

 

So, obviously..   PC DOS IS THE ROOT OF ALL EVIL !

 

SpenMarsden

10 years 8 months ago

Well the best workaround I can come up with so far is to:

open a misbehaving file in gedit, edit it there to clean up space carriage return gumbo

and then to copy/paste it into the MRL new python service. It then will a.work and b.save and work again.

Now I am wincing every time I press the return key..THANKS BILL GATES :)