Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2434

[macOS] Fix 'NSError' object has no attribute 'utf8ValueSafe'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.5.0
    • Fix Version/s: 4.5.0
    • Component/s: Tests

      Description

      self = <tests.old_functional.test_special_characters.TestSpecialCharacters testMethod=test_rename_local>
      
          @not_windows(reason="Explorer prevents using those characters")
          def test_rename_local(self):
              local = self.local_1
              remote = self.remote_1
          
              self.engine_1.start()
              self.wait_sync(wait_for_async=True)
          
              folder_name = "abcd"
              file_name = "efgh.txt"
              folder = local.make_folder("/", folder_name)
              local.make_file(folder, file_name, content=b"This is a test file")
          
              self.wait_sync()
              assert remote.exists(f"/{folder_name}")
              assert remote.exists(f"/{folder_name}/{file_name}")
          
              new_folder_name = "/ * ? < > |"
              new_folder_name_expected = "- - - - - -"
              new_file_name = "| > < ? * /.txt"
              new_file_name_expected = "- - - - - -.txt"
      >       local.rename(f"/{folder_name}", new_folder_name)
      
      file_name  = 'efgh.txt'
      folder     = PosixPath('abcd')
      folder_name = 'abcd'
      local      = <MacLocalClient base_folder=PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643'), is_case_sensitive=None>
      new_file_name = '| > < ? * /.txt'
      new_file_name_expected = '- - - - - -.txt'
      new_folder_name = '/ * ? < > |'
      new_folder_name_expected = '- - - - - -'
      remote     = <RemoteBase args=None, kwargs=None, upload_tmp_dir=PosixPath('/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/uploads')>
      self       = <tests.old_functional.test_special_characters.TestSpecialCharacters testMethod=test_rename_local>
      
      tests/old_functional/test_special_characters.py:63: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = <MacLocalClient base_folder=PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643'), is_case_sensitive=None>
      srcref = '/abcd', to_name = '/ * ? < > |'
      
          def rename(self, srcref: str, to_name: str):
              parent = os.path.dirname(srcref)
              dstref = os.path.join(parent)
      >       self.move(srcref, dstref, name=to_name)
      
      dstref     = '/'
      parent     = '/'
      self       = <MacLocalClient base_folder=PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643'), is_case_sensitive=None>
      srcref     = '/abcd'
      to_name    = '/ * ? < > |'
      
      tests/old_functional/local_client_darwin.py:52: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = <MacLocalClient base_folder=PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643'), is_case_sensitive=None>
      srcref = '/abcd', parentref = '/', name = '/ * ? < > |'
      
          def move(self, srcref: str, parentref: str, name: str = None) -> None:
              src = self.abspath(srcref)
              parent = self.abspath(parentref)
          
              dst = parent / (name or src.name)
          
              error = None
              result = self.fm.moveItemAtPath_toPath_error_(str(src), str(dst), error)
              time.sleep(0.3)
      >       self._process_result(result)
      
      dst        = PosixPath('/ * ? < > |')
      error      = None
      name       = '/ * ? < > |'
      parent     = PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643')
      parentref  = '/'
      result     = (False,
       Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSDestinationFilePath=/ * ? < > |, NSUserStringVariant=Move, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d77ff0 {Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSSourceFilePathErrorKey=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUserStringVariant=(
          Copy
      ), NSDestinationFilePath=/ * ? < > |, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d74a10 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}})
      self       = <MacLocalClient base_folder=PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643'), is_case_sensitive=None>
      src        = PosixPath('/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd')
      srcref     = '/abcd'
      
      tests/old_functional/local_client_darwin.py:47: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      result = (False, Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is ...rwin-16643/abcd, NSUnderlyingError=0x7fc3d9d74a10 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}})
      
          @staticmethod
          def _process_result(result):
              ok, err = result
              if not ok:
      >           raise OSError(err.utf8ValueSafe())
      E           AttributeError: 'NSError' object has no attribute 'utf8ValueSafe'
      
      err        = Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSDestinationFilePath=/ * ? < > |, NSUserStringVariant=Move, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d77ff0 {Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSSourceFilePathErrorKey=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUserStringVariant=(
          Copy
      ), NSDestinationFilePath=/ * ? < > |, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d74a10 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}}
      ok         = False
      result     = (False,
       Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSDestinationFilePath=/ * ? < > |, NSUserStringVariant=Move, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d77ff0 {Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSSourceFilePathErrorKey=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUserStringVariant=(
          Copy
      ), NSDestinationFilePath=/ * ? < > |, NSFilePath=/private/var/folders/b6/t8dzh1094157tl2364wnb1jh0000gn/T/1bd58717/1/drive/test_rename_local-darwin-16643/abcd, NSUnderlyingError=0x7fc3d9d74a10 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}})
      
      tests/old_functional/local_client_darwin.py:65: AttributeError
      

      The revelant error is:

      AttributeError: 'NSError' object has no attribute 'utf8ValueSafe'
      

      cf https://developer.apple.com/documentation/foundation/nserror?language=objc

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h