I am trying to get your synapseclient to work, using python 2 environment on PC
Got an error:
">>> syn.store(File('d:/results.txt', parentId='syn18415981'))
################################################## Uploading file to Synapse storage##################################################
Uploading [####################]100.00% 16.9kB/16.9kB results.txt Done... Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/site-packages/synapseclient/client.py", line 970, in store mimetype=local_state_fh.get('contentType')) File "/usr/lib/python2.7/site-packages/synapseclient/upload_functions.py", line 67, in upload_file_handle return upload_synapse_s3(syn, expanded_upload_path, location['storageLocationId'], mimetype=mimetype) File "/usr/lib/python2.7/site-packages/synapseclient/upload_functions.py", line 127, in upload_synapse_s3 syn.cache.add(file_handle_id, file_path) File "/usr/lib/python2.7/site-packages/synapseclient/cache.py", line 225, in add cache_map[path] = epoch_time_to_iso(floor(_get_modified_time(path)))TypeError: a float is required"
What might be wrong?
Created by Chunyu Liu liucy datetime.datetime(2016, 7, 25, 20, 24, 25)
everything confirmed so far. @liucy I'm expecting `date` in this format:
```
>>> date
datetime.datetime(2016, 7, 25, 20, 24, 25)
```
can you verify the type of `date` is a `datetime` object as follows:
```
>>> type(date)
``` 1469478265.0
2016-07-25 20:24:25 Hi @liucy ,
To help us investigate the problem, please provide the output for the following commands:
```
import os
from datetime import datetime
secs = os.path.getmtime('d:/results.txt')
print(secs)
date = datetime.utcfromtimestamp(abs(secs))
print(date)
``` actually it was in a usb drive.
But I copied it to c:/ still the same error! Hi @liucy ,
Is the drive (`d:/`) where the file `results.txt` is stored a network or cloud-based drive? If so, could you verify that if you put this file on a local drive (commonly `c:/`) that you could get this feature to work?
```python
# Move results.txt to the C drive (or another local drive) and try again
syn.store(File('c:/results.txt', parentId='syn18415981'))
```
Thanks! updated to python3, 1.9.2 client, same error.
Uploading [####################]100.00% 16.9kB/16.9kB results.txt Done...
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/site-packages/synapseclient/client.py", line 971, in store
mimetype=local_state_fh.get('contentType'))
File "/usr/lib/python3.6/site-packages/synapseclient/upload_functions.py", line 67, in upload_file_handle
return upload_synapse_s3(syn, expanded_upload_path, location['storageLocationId'], mimetype=mimetype)
File "/usr/lib/python3.6/site-packages/synapseclient/upload_functions.py", line 127, in upload_synapse_s3
syn.cache.add(file_handle_id, file_path)
File "/usr/lib/python3.6/site-packages/synapseclient/cache.py", line 225, in add
cache_map[path] = epoch_time_to_iso(floor(_get_modified_time(path)))
TypeError: must be real number, not NoneType
Hi @liucy ,
The latest version of the Synapse Python client is 1.9.2. I would recommend upgrade to the latest version an try again. Please let me know if the problem persists.
Also, Python 2.7 is deprecated and [will be gone soon](https://python3statement.org/). I recommend upgrade to Python 3.5 or later version sooner rather than later. >>> synapseclient.__version__
u'1.9.0'
>>> import os
>>> os.path.exists("d:/results.txt")
True
u'1.9.0'
>>> import os
>>> os.path.exists("d:/results.txt")
True
Also, please provide the output for these Python commands:
```
import os
os.path.exists("d:/results.txt")
``` @liucy , what version of the Synapse Python client are you using? You can find this information by either run the command line client:
```
synapse --version
```
or in Python:
```
import synapseclient
synapseclient.__version__
```
Hello @liucy,
I'm looping in one of our engineers to see if we can help diagnose this issue for you. cc: @kimyen
Thank you!