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

Specify tuspy version explicitly. #136

Merged
merged 1 commit into from
Sep 7, 2018
Merged

Specify tuspy version explicitly. #136

merged 1 commit into from
Sep 7, 2018

Conversation

Onebrownsound
Copy link
Collaborator

@Onebrownsound Onebrownsound commented Sep 7, 2018

What:

  • Makes upload example Python 3 friendly.
  • Changes tuspy back to 0.2.1 as an exact match.

Why:

  • Internal tuspy library changes will not function with Python 2.7 out of the box, without modifications.

Tidbits:

  • The line in question which was blowing up for tuspy versions >=0.2.2.
  • The line which serves the same function in tuspy version 0.2.1.

The difference between them, is the TusRequest.handle attribute. For 0.2.1 it is a pycurl instance, which appears to be able to handle unicode characters in a Python 2.7 string.
While the TusRequest.handle attribute for versions >=0.2.2 is an http.client.HTTPSConnection instance which appears to not function for Python 2.X, even if at the IO boundary we specify the file encoding as utf-8.

The screenshot below, demonstrates an upload (which was failing in the same manor as various user reports) is now succeeding.

screen shot 2018-09-06 at 4 35 44 pm

TL;DR This should fix the various user reports that have been received.

@erunion

// #134 #135

Python 3 friendly, upload example.
@@ -21,7 +21,7 @@
# Create a variable with a hard coded path to your file system
file_name = '<full path to a video on the filesystem>'

print 'Uploading: %s' % file_name
print('Uploading: %s' % file_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for these changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example wouldn't run in Python 3, because print took on the signature of a functionprint 'lkjds -> print('blah'). This change will function for both 2 && 3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know.

@erunion
Copy link
Contributor

erunion commented Sep 7, 2018

Super cool that tuspy kind of dropped 2.7 support in a Semver patch release.

@erunion erunion merged commit 32f3ee4 into master Sep 7, 2018
@erunion erunion deleted the api-3032 branch September 7, 2018 17:31
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

Successfully merging this pull request may close these issues.

2 participants