[Bf-python] OBJ import (another bug?)
Campbell Barton
cbarton at metavr.com
Tue Oct 5 01:25:27 CEST 2004
Hi, sure I could do this manually- but manual python workarounds
shouldent be needed.
We should wither report this as a bug to the python people or make some
solution our self- The whole point of a language like python is that it
does this kinda stuff for you- If parts of it dont work then they should
be fixed.
Splitting by words stuffs things up for the obj format and splitting
manually is slow, mabe this bug should be reported to the python people?-
Cam
Stephane SOPPERA wrote:
> Campbell Barton wrote:
>
>> Well I did a dos2unix using nedit. open and save- then it works.
>>
>> The line seperation is done with pythons readlines so mabe there is a
>> but with that???
>>
>> Im just saying the bug is in the readlines function, since its read
>> as 1 line. (I tested this)
>
>
> Actually this file's lines are separated by only a '\r'. Usually,
> lines are separated with a '\n' on unix and '\r\n' on windows.
> Since "\r" means that the cursor should return at the start of the
> line without going to the next line, the following string:
> "hello\rworld\r!" should display "!orld". I've just checked that it's
> what python displayed when you type print "hello\rworld\r!" on linux.
> So the obj files on the site are misformed. They are not correct
> windows files.
>
> Maybe something like:
> string=file.read()
> lines=string.split()
> instead of:
> lines=file.readlines()
> will solve the issue and make the script works with misformed files.
>
> I've tested on linux that "my\rstring\r\nis\nok".split() give ['my',
> 'string', 'is', 'ok'] so it might be ok on other plateforms.
>
> Bye,
> Stephane
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python
mailing list