kronenthaler/mod-pbxproj

[BUG]Save() Error during saving the project: 'str' object has no attribute '_get_comment'

Opened this issue · 1 comments

Describe the bug
A clear and concise description of what the bug is.

project = XcodeProject.load(kProjectFilePath)
project.save()

System information

  1. pbxproj version used: 4.1.0
  2. python version used: 3.9
  3. Xcode version used:15.4

Error during saving the project: 'str' object has no attribute '_get_comment'
Error: 'str' object has no attribute '_get_comment'
Traceback (most recent call last):
File "/Users/iospack/Desktop/BaoHeAutoPackge/script/archive.py", line 96, in _modifyProject
project.save()
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/XcodeProject.py", line 56, in save
file.write(self.repr() + "\n")
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/XcodeProject.py", line 65, in repr
return '// !$UTF8$!\n' + super(XcodeProject, self).repr()
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXGenericObject.py", line 76, in repr
return self._print_object()
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXGenericObject.py", line 81, in _print_object
value = self._format(self[key], indent_depth, entry_separator, object_start,
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXGenericObject.py", line 102, in _format
value = value._print_object(indentation_depth + indentation_increment,
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXObjects.py", line 47, in _print_object
result += f'{indent_depth}\t{value.get_id().repr()} = {obj};\n'
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXKey.py", line 8, in repr
comment = self._get_comment()
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXKey.py", line 20, in _get_comment
return self.get_parent()._resolve_comment(self)
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/PBXGenericObject.py", line 158, in _resolve_comment
return self[key]._get_comment()
File "/Users/iospack/Library/Python/3.9/lib/python/site-packages/pbxproj/pbxsections/PBXBuildFile.py", line 45, in _get_comment
comment = self.fileRef._get_comment()
AttributeError: 'str' object has no attribute '_get_comment'