#emc-devel | Logs for 2007-02-01

Back
[03:51:50] <jmkasunich> hi jeff
[03:58:39] <jmkasunich> any python folks around?
[04:00:40] <cradek> jmkasunich: barely
[04:00:54] <jmkasunich> a, b = f.split("\n;;\n", 1)
[04:01:14] <jmkasunich> I'm guessing that is supposed to split some string into parts a and b
[04:01:32] <jmkasunich> the "\n;;\n" part has me guessing
[04:01:55] <jmkasunich> this is line 598 of comp.py, if you want context
[04:01:55] <cradek> pydoc string.split
[04:02:10] <cradek> I think it's splitting on a line consisting of only ;;
[04:03:14] <cradek> yeah, a and b are the parts of the file before/after the ;; line
[04:03:19] <jmkasunich> that would make sense if he's splitting the file into the header stuff (comp processes it) and the rest (comp just copies it to the C file)
[04:03:26] <cradek> right
[04:03:33] <jmkasunich> so f is the entire contents of the file?
[04:03:42] <cradek> yes
[04:03:59] <jmkasunich> and the error is:
[04:04:00] <jmkasunich> a, b = f.split("\n;;\n", 1)
[04:03:59] <jmkasunich> ValueError: need more than 1 value to unpack
[04:04:19] <cradek> does your file have stuff before and after the ;; ?
[04:04:38] <jmkasunich> is f.split (foo, bar) the same as split (f, foo, bar)?
[04:04:45] <jmkasunich> yes it does
[04:04:59] <cradek> yes I think those do the same things
[04:05:03] <jmkasunich> how does one print?
[04:05:05] <cradek> can you pastebin your file?
[04:05:10] <jmkasunich> print f?
[04:05:18] <cradek> yes
[04:05:39] <cradek> >>> f="abc"
[04:05:40] <cradek> >>> print f
[04:05:40] <cradek> abc
[04:05:58] <jmkasunich> http://pastebin.ca/335152
[04:06:38] <cradek> maybe your \ are wrong
[04:06:45] <cradek> to do multi-line strings easily, use """
[04:07:12] <jmkasunich> three in a row?
[04:07:15] <cradek> a="""
[04:07:15] <cradek> b
[04:07:14] <cradek> c
[04:07:15] <cradek> """
[04:08:06] <jmkasunich> I added a print f - the entire string including the :: on a line by themselves gets printed
[04:10:19] <jmkasunich> I just changed " to """ and got rid of the end-of-line escapes
[04:11:03] <jmkasunich> no change
[04:11:27] <jmkasunich> my change ( and I assume jepler's port of it into comp.g) didn't even touch this
[04:13:13] <cradek> I get the error too
[04:16:26] <cradek> what did you create this file with!?!?
[04:16:32] <cradek> it's in dos mode, or at least part of it is
[04:16:42] <jmkasunich> hmm
[04:16:44] <cradek> consequently, there's no \n;;\n in it
[04:16:58] <jmkasunich> I created it using gedit on the dapper vm at work
[04:17:04] <jmkasunich> and mailed it to myself
[04:17:23] <jmkasunich> then extracted the attachment into this dapper system
[04:17:26] <cradek> webmail?
[04:17:29] <jmkasunich> yes
[04:17:33] <jmkasunich> but as an attachment
[04:17:38] <cradek> that's a curse
[04:17:58] <cradek> can you tell what content type it used?
[04:18:51] <jmkasunich> Include Attachment 1: clarke2.comp (application/octet-stream)
[04:19:03] <jmkasunich> binary IOW
[04:19:08] <jmkasunich> (I think)
[04:19:08] <cradek> that's surprising
[04:19:16] <cradek> wonder what mangled it
[04:19:21] <jmkasunich> no clue
[04:19:26] <cradek> I bet you $1 it's right on your dapper system :-)
[04:19:41] <jmkasunich> no bet - I know it worked there
[04:20:17] <jmkasunich> the thought of newline mangling crossed my mind - but I've opened it and saved it with kate and it both looked fine and is still busted
[04:20:39] <cradek> kate probably hides dos mode from you and preserves it
[04:20:44] <cradek> (which is arguably the right behavior)
[04:20:57] <cradek> "hal/components/335152.comp" [noeol][dos] 31L, 1242C
[04:21:00] <cradek> vim says this
[04:21:09] <jmkasunich> curses upon dos
[04:21:10] <cradek> I think [noeol] means the last newline is missing too
[04:21:37] <cradek> curses upon broken email programs IMO
[04:22:36] <cradek> it builds after I dos2unix it
[04:22:45] <jmkasunich> fsckin dos
[04:22:50] <jmkasunich> and fsckin email
[04:22:59] <A-L-P-H-A> fsckin? :)
[04:23:10] <jmkasunich> and fsckin editors too
[04:23:21] <A-L-P-H-A> fsckin girls!
[04:23:26] <jmkasunich> if I open a unix file in a dos editor it looks like crap
[04:23:40] <jmkasunich> if I open a dos file in a unix editor it should also look like crap
[04:23:45] <A-L-P-H-A> oh... 13 10.
[04:23:46] <jmkasunich> because it _is_ crap
[04:23:48] <A-L-P-H-A> or was it 10 13?
[04:24:11] <cradek> I think it should warn you, and also let you edit it (like vim does)
[04:26:06] <jmkasunich> kate lets you select the line endings you want, but it has this little box "auto line end detection"
[04:26:20] <jmkasunich> turned that off, and now it seems to have de-dosified the file
[04:26:29] <cradek> cool
[04:29:42] <jmkasunich> much better
[04:29:57] <jmkasunich> except I just noticed I made one mistake when I added the new stuff to comp
[04:30:15] <jmkasunich> the DESCRIPTION part of the man page is supposed to be before the FUNCTIONS part
[04:30:32] <jmkasunich> * jmkasunich tiptoes carefully thru comp.g
[04:30:38] <cradek> haha
[04:31:16] <cradek> I'd be tempted to try to have it transform _word_ to \fBword\fR
[04:31:27] <jmkasunich> why
[04:31:40] <cradek> because they're clumsy to edit and error-prone
[04:31:59] <jmkasunich> man page formatting is what it is - why make another dialect just for comp manpages
[04:32:27] <cradek> ok, no fight from me
[04:32:33] <jmkasunich> there are times when you want \fBfoo\fIbar\fR
[04:33:08] <jmkasunich> ok, now I see why I put description after functions
[04:33:13] <jmkasunich> but I don't understand
[04:33:23] <jmkasunich> isn't indenting in python like {} in C?
[04:33:46] <cradek> yes
[04:34:24] <jmkasunich> it looks like I'm gonna have duplicate code ;-(
[04:34:51] <jmkasunich> I want to insert the description between synopsis and functions
[04:35:27] <jmkasunich> and right now, both synopsis and functions are in one branch of an if
[04:35:38] <jmkasunich> but user space stuff (which still needs description) is in the other branch
[04:36:03] <cradek> can you make a function?
[04:36:19] <jmkasunich> maybe I should end that first chunk after the synopsis, then do the descr, then do another if (userspace) and put the functions part of not
[04:36:35] <jmkasunich> if nto
[04:36:37] <jmkasunich> if not
[04:37:37] <jmkasunich> whats the ptyhon equivalent of if ( ! foo ) { ?
[04:38:12] <cradek> if not foo:
[04:38:21] <cradek> indent next line
[04:38:31] <jmkasunich> so:
[04:38:32] <jmkasunich> if not options.get("userspace"):
[04:38:33] <jmkasunich> print >>f, ".SH FUNCTIONS"
[04:38:45] <cradek> that looks good
[04:39:06] <cradek> python at the shell gives a nice interactive mode to experiment with, I always test unsure syntax there
[04:39:47] <jmkasunich> in this case tho, don't I need to have options.get() and a bunch of other stuff defined to test it?
[04:40:39] <cradek> I don't understand
[04:40:55] <jmkasunich> if not options.get("userspace")
[04:41:12] <jmkasunich> I can't just put that in python without having the whole program
[04:41:16] <jmkasunich> can I?
[04:41:31] <jmkasunich> I mean, isn't options.get a function that is defined farther up in the file?
[04:42:56] <jmkasunich> oh well, it seems to be working
[04:43:22] <cradek> options is built up inside the option function
[04:44:27] <cradek> goodnight jmk
[04:44:45] <jmkasunich> goodnight
[04:45:36] <cradek> instead of 'print "%s" % var', you can 'print var'
[04:46:29] <jmkasunich> I think the code I copied it from was printing two fields ;-)
[04:46:49] <cradek> yeah the % is useful for more complex formatting
[04:47:15] <jmkasunich> I'm gonna concentrate on getting the other two clarke comps done, don't want to OD on this python stuff....
[04:47:22] <jmkasunich> gotta take baby steps you know...
[04:47:45] <cradek> yep
[04:47:49] <cradek> and goodnight again
[04:47:51] <jmkasunich> thanks for the tip about the triple quotes
[04:47:54] <jmkasunich> goodnight
[04:47:57] <cradek> sure