View Full Version : Mysterious Line Breaks when I Load Script
Dustin 10-27-2009, 11:51 PM OK, so I am writing a script, and if I copy and paste it from jEdit (a text editor for Mac) to Maya, the script works as it should. However, if I save the file, and try File>Load Script... in the script editor, it adds a line break somewhere in my script.
I got rid of the line break, saved it out as a .mel from the script editor, and tried loading it again. Now, it added a line break to the next line down. Went through it again, and it moved to the next line. I am not about to go through this process 4,000 more times.
It is mel, not python that I am working with, if that helps. Any ideas?
|
|
sciLoop
10-28-2009, 03:36 PM
Maybe try to copy it to windows notepad, save it and then reload it in Maya.
If its not a Maya related bug, you should get rid of all that formatting.
Darksuit
10-28-2009, 06:20 PM
since you may not have access to notepad ( being that your using a MAC), you may also want to try coping the script to any text editor that does not specifically insert linebreaks some examples are
VIM http://www.vim.org/
Emacs http://www.gnu.org/software/emacs/
Notepad++ http://notepad-plus.sourceforge.net/uk/site.htm
Dustin
11-08-2009, 05:30 AM
I tried saving it out from text edit (notepad equivalent), and it still has the same issues, even as a different file format. Saved it out from jedit, and opened it in text edit, all is fine there too.
So it leads me to believe that it is a maya problem. Especially when I fix it in the script editor, and save the file from Maya. And then if I load it, it just bumps the problem to the next line. But this only happens when loading into maya. Copying and pasting works fine, and if I open the .mel file I save from Maya in text edit or jedit, it does not have the line breaks.
Dustin
11-08-2009, 05:48 AM
I just tried something else, to see. I selected several objects, and locked and hid all the channels, just to get a lot of script added to the history. Looking through this, there were several line breaks in what the script editor was spitting this out.
It seems likely that this would be related to the issue I am having.
sciLoop
11-08-2009, 11:15 AM
So, even in the script editor history there are the line breaks?
It seems your Maya got nuts.
Maybe just reinstall your Maya copy.
ristopuukko
11-09-2009, 06:54 AM
Dustin
check your Jedit preferences which line break style it is using for ascii text files.
Windows, *nix and osX use natively different linebreak codes in their
text files.
/risto
Dustin
11-15-2009, 04:34 AM
Hey Risto,
The closest thing I could find was Default Line Separator, which is set to Unix \n, if that is what you are referring to. But to my understanding, that is something that is typed in, which I am not using where these line breaks occur. The line breaks I am seeing are not typed in, nor are they occurring anywhere other than in maya.
Thanks.
ristopuukko
11-15-2009, 07:10 AM
Dustin,
can you post an example script which goes haywire ?
/risto
Dustin
11-15-2009, 09:05 PM
It's a lengthy script for an auto-rig I am working on. Here is an example:
// Error: setAttr "HeadCG_orientCons //
// Error: Line 6028.27: Unterminated string. //
This is what the line looks like when loaded into the script editor:
setAttr "HeadCG_orientCons
traint1.NeckCW1" 0;
but any other software opens it properly, and copying and pasting into the script editor is fine too. Is it possible that the length of the script is the problem?
Dustin
11-16-2009, 12:27 AM
I went through the whole script, and there were 8 or 9 breaks, all at different parts of the line, different commands, etc. No pattern to it that I can see...
ristopuukko
11-16-2009, 04:27 PM
Well Dustin,
it's quite impossible to say anything without the file.
What I would do is run the file through a piece of code (script,
a little program snippet or whatever) which searches the
newline(10) and carriage return(13) - ascii codes from it .
After that would be possible to jump in to conclusions.
/risto
Pyrokinesis
11-21-2009, 11:19 AM
Hey Dustin, What happens when you open a port and launch it from Jedit, or source the script instead of load it?
Dustin
11-24-2009, 02:32 AM
Hey Risto,
I am not sure of what code I can use that I could run my script through...
Pryo,
Sorry, but I am not sure what you mean by opening a port and launching from jedit... still pretty new to this whole scripting thing.
Sourcing the script works perfectly. So I guess I can just use that instead. Seems really strange that sourcing doesn't break it up, but loading does.
Thanks for your help, guys!
ristopuukko
11-24-2009, 07:18 AM
I am not sure of what code I can use that I could run my script through...
Dustin,
I meant that I would code _myself_ a little script, program, whatever, which would search those ascii codes from your script file.
You can do it yourself with whatever language you might know or then try to find a clever enough editor which could do the search for you.
/risto
Dustin
11-24-2009, 01:02 PM
Oh ok, thanks Risto, still very new to all this scripting stuff, but slowly learning.
Pyrokinesis
11-30-2009, 09:21 PM
Opening a command port allows you to launch your code from within Jedit in Maya.
I encourage you to look it up to learn more.
Its really handy, and you will be glad you took the time to learn how :)
Dustin
12-13-2009, 06:47 AM
I will definitely look into that. Sorry, haven't touched this stuff in a while. Just started looking at it again. Sourcing seems to work, so I will just run with that for now.
Thanks guys!
efecto
12-13-2009, 08:49 AM
Opening a command port allows you to launch your code from within Jedit in Maya.
I encourage you to look it up to learn more.
Its really handy, and you will be glad you took the time to learn how :)
how can one open a port so jedit works with maya?
CGTalk Moderation
12-13-2009, 08:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.