[Bf-python] Blender.sys.basename() different from os.path.basename() on Windows

Levi Schooley bpycadmin at hhofministries.org
Fri Mar 9 06:06:37 CET 2007


OK, great. I'll go ahead and submit a bug report. I just wanted to make sure it
was an oversight, and not something that was implemented on purpose. I was
reading filepaths from archives using the zipfile module, and they use the "/"
separator. In that particular instance, importing and using the os module isn't a
problem (I know they have it 'cause I'm using the zipfile module), but it would
be easier to just use Blender's path functions (or include my own; but who wants
to do that?).

Thanks!
Levi


Martin wrote:
> On win32, os.altsep is defined as "/" and os.sep as
> "\\", that means both separator are accepted (and as
> such, Blender.sys.basename is not working right).

Campbell wrote:
> Blender's path functions are path dependant.
> \ - win32, / other os's
>
> interesting that the OS module works differently...
> It wouldnt be that hard to change blenders to work
> like os's

jms wrote:
> Try the bug tracker :
> http://projects.blender.org/tracker/\?atid=125&group_id=9&func=browse
> ...
> In the next Blender, the os module will be no more bundled.

On Thu Mar  8 12:29 , Levi Schooley sent:
>Hello,
>
>I know this is a bit picky, but I just noticed that the following script prints
>two different results.
>
># On Windows only
>import Blender, os
>print os.path.basename("foo/foo.py") # prints "foo.py"
>print Blender.sys.basename("foo/foo.py") # prints "foo/foo.py" ???
>
>Is this expected behaviour? It's not a big problem since Blender comes bundled
>with the os module, but it would be a little more convenient if Blender.sys
>worked "as expected." Blender.sys.dirname() has the same issue.
>
>Thanks!
>Levi
>_______________________________________________
>Bf-python mailing list
>Bf-python at projects.blender.org
>http://projects.blender.org/mailman/listinfo/bf-python
>



More information about the Bf-python mailing list