Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on last_modified_date_time #21

Closed
Stullemon opened this issue Feb 24, 2016 · 1 comment
Closed

Exception on last_modified_date_time #21

Stullemon opened this issue Feb 24, 2016 · 1 comment
Assignees
Labels

Comments

@Stullemon
Copy link

Hi,

I have been using a backup script which used the live_api used in an older version of onedrive-d. Using this script, I uploaded all the files in a specific folder.

I am in the process of updating this script of mine to work use onedrivesdk. However, I noticed that the sdk has some issues when I try to check the last_modified_date_time of the files I have already uploaded. The traceback looks as follows:

Traceback (most recent call last):

  File "<ipython-input-24-f4000242bd12>", line 1, in <module>
    debugfile('F:/IWU/Python_new/OneDriveUpdate.py', wdir='F:/IWU/Python_new')

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 808, in debugfile
    debugger.run("runfile(%r, args=%r, wdir=%r)" % (filename, args, wdir))

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\bdb.py", line 431, in run
    exec(cmd, globals, locals)

  File "<string>", line 1, in <module>

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 87, in execfile
    exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

  File "f:/iwu/python_new/onedriveupdate.py", line 532, in <module>
    if not checkDirContent(rootDir, upDirID, posFilter):

  File "f:/iwu/python_new/onedriveupdate.py", line 262, in checkDirContent
    if not checkDirContent(localItem['path'], dirID, None, (localItem['name'] == 'Zotero'), (defaultDelete and localItem['name'] == 'storage')):

  File "f:/iwu/python_new/onedriveupdate.py", line 262, in checkDirContent
    if not checkDirContent(localItem['path'], dirID, None, (localItem['name'] == 'Zotero'), (defaultDelete and localItem['name'] == 'storage')):

  File "f:/iwu/python_new/onedriveupdate.py", line 262, in checkDirContent
    if not checkDirContent(localItem['path'], dirID, None, (localItem['name'] == 'Zotero'), (defaultDelete and localItem['name'] == 'storage')):

  File "f:/iwu/python_new/onedriveupdate.py", line 284, in checkDirContent
    ulFileTimeDT = file.last_modified_date_time

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\site-packages\onedrivesdk\model\item.py", line 196, in last_modified_date_time
    return datetime.strptime(self._prop_dict["lastModifiedDateTime"].replace("Z", ""), "%Y-%m-%dT%H:%M:%S.%f")

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)

  File "F:\Software\WinPython\python-3.4.3.amd64\lib\_strptime.py", line 337, in _strptime
    (data_string, format))

ValueError: time data '2014-11-05T11:47:34' does not match format '%Y-%m-%dT%H:%M:%S.%f'

Note the missing microseconds. For the time being I am simply using a try/except to default to the 1970/1/1. Anyhow, I do not know what causes the time to be weird/not like expected. I assume this is either an issue on the server side (bad truncation if microseconds==0?) or an issue in the sdk which should be caught on your end. It would be awesome if you could attend to the matter.

Regards,
Stulle

@cdmayer
Copy link
Contributor

cdmayer commented Feb 25, 2016

Fixed in #24

@cdmayer cdmayer closed this as completed Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants