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

Upload assets not working using Python #32

Closed
rajiv-hqvfx opened this issue Apr 9, 2020 · 4 comments
Closed

Upload assets not working using Python #32

rajiv-hqvfx opened this issue Apr 9, 2020 · 4 comments

Comments

@rajiv-hqvfx
Copy link

I am using Python 3.7 on windows 10.

from frameioclient import FrameioClient
import os

client = FrameioClient("MY_TOKEN_HERE")

mov = "D:/Development/rc/frameio/a.mp4"
filesize = os.path.getsize(mov)

# Create a new asset.
asset = client.create_asset(
  parent_asset_id="MY_ASSET_ID",
  name="MyVideo.mp4",
  type="file",
  filetype="video/mp4",
  filesize=filesize
)

# Upload the file at the target asset.
file = open(mov, "rb")
client.upload(asset, file)

When I am trying to upload .mp4 file using python file getting error.

D:\Development\rc\frameio\venv\Scripts\python.exe D:/Development/rc/frameio/demo01.py
Traceback (most recent call last):
File "D:/Development/rc/frameio/demo01.py", line 20, in
client.upload(asset, file)
File "D:\Development\rc\frameio\venv\lib\site-packages\frameioclient\client.py", line 238, in upload
uploader.upload()
File "D:\Development\rc\frameio\venv\lib\site-packages\frameioclient\upload.py", line 33, in upload
proc.start()
File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Program Files\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "C:\Program Files\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot serialize '_io.BufferedReader' object

@OxB03
Copy link

OxB03 commented Apr 9, 2020 via email

@rajiv-hqvfx
Copy link
Author

Its working now.
I changed this in upload.py

# from multiprocessing import Process
from multiprocessing_on_dill import Process

@jhodges10
Copy link
Contributor

jhodges10 commented Apr 15, 2020

@vfxpandit @OxB03 I'm about to merge in a big update that should fix all the uploader woes as well as introduces more testing around python versions so that this doesn't happen in the future!

I don't necessarily recommend using that multiprocessing_on_dill library as it isn't very actively maintained / used. The solution in #35 is done using standard python libraries which should make it more reliable.

@jhodges10
Copy link
Contributor

I have now merged this into master and released v0.7.5. This should fix your problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants