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

[Windows] OSError with datetime.fromtimestamp(t) when t < 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0.4
    • Fix Version/s: 4.1.1
    • Component/s: Framework

      Description

      OSError: [Errno 22] Invalid argument
        File "nxdrive\manager.py", line 654, in bind_engine
          self, engine_def, binder=binder
        File "nxdrive\engine\engine.py", line 127, in __init__
          self.bind(binder)
        File "nxdrive\engine\engine.py", line 814, in bind
          self._check_root()
        File "nxdrive\engine\engine.py", line 834, in _check_root
          self._add_top_level_state()
        File "nxdrive\engine\engine.py", line 889, in _add_top_level_state
          remote_info = self.remote.get_filesystem_root_info()
        File "nxdrive\client\remote_client.py", line 266, in get_filesystem_root_info
          return RemoteFileInfo.from_dict(toplevel_folder)
        File "nxdrive\objects.py", line 69, in from_dict
          last_update = datetime.fromtimestamp(timestamp // 1000) if timestamp else None
      

      The error happens when the timestamp is less than zero. A Python bug has been opened: https://bugs.python.org/issue36439

      But, given our current code, this error cannot happen ... So I open the issue to track down future similar errors until we found an eventual fix on our side (if any).

      To reproduce, I copied inputs from the Sentry event into this test file:

      from nxdrive.objects import RemoteFileInfo
      
      fs_item = {
          "canCreateChild": False,
          "canDelete": False,
          "canRename": False,
          "canScrollDescendants": False,
          "creationDate": 771,
          "creator": "system",
          "folder": True,
          "id": "org.nuxeo.drive.service.impl.DefaultTopLevelFolderItemFactory#",
          "lastContributor": "system",
          "lastModificationDate": 771,
          "lockInfo": None,
          "name": "Nuxeo Drive",
          "parentId": None,
          "path": "/org.nuxeo.drive.service.impl.DefaultTopLevelFolderItemFactory#",
          "userName": "Administrator",
      }
      
      obj = RemoteFileInfo.from_dict(fs_item)
      print(obj)
      

      But this code works like a charm on Windows 7 and 10.

        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 - 15 minutes
                  15m