[Bf-python] Blender.Save() complaints for paths longer than 80
Campbell Barton
cbarton at metavr.com
Wed Aug 1 11:17:57 CEST 2007
This is a bug, will correct, thanks for pointing it out.
Dietrich Bollmann wrote:
> Hi,
>
> When trying to save a blender file with 'Blender.Save()' an error is
> printed for filenames longer than 80. As FILE_MAXDIR is defined as
> 160 and FILE_MAXFILE as 80 I suppose this is a bug?
>
> Example:
>
> > 1 2 3 4 5
> 6 7 8
>
>> 12345678901234567890123456789012345678901234567890123456789012345678901234567890
> >>> filename80 =
> '/home/dietrich/67890123456789012345678901234567890123456789012345678901234.blend'
> >>> filename81 =
> '/home/dietrich/678901234567890123456789012345678901234567890123456789012345.blend'
> >>> len(filename80)
> 80
> >>> len(filename81)
> 81
> >>> Blender.Save(filename80, True)
> >>> Blender.Save(filename81, True)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: filename is too long!
> >>>
>
> The code is in blender/source/blender/python/api2_2x/Blender.c :
>
> static PyObject *Blender_Save( PyObject * self, PyObject * args )
> {
> ...snip...
>
> len = strlen( fname );
>
> if( len > FILE_MAXFILE )
> return EXPP_ReturnPyObjError( PyExc_AttributeError,
> "filename is too long!" );
> ...snip...
> }
>
> and probably rather should read:
>
> static PyObject *Blender_Save( PyObject * self, PyObject * args )
> {
> ...snip...
>
> len = strlen( fname );
>
> if( len > (FILE_MAXDIR + FILE_MAXFILE) )
> return EXPP_ReturnPyObjError( PyExc_AttributeError,
> "filename is too long!" );
> ...snip...
> }
>
> Thank you :)
>
> Dietrich
>
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
--
Campbell J Barton (ideasman42)
More information about the Bf-python
mailing list