Skip to content

Conversation

yash-nisar
Copy link
Contributor

Python3 returns 'bytes' and not 'str' when reading/writing
to/from a binary stream. So, the files need to be opened in
text mode for str related operations.

Signed-off-by: Yash Nisar [email protected]

Closes #36

Python3 returns 'bytes' and not 'str' when reading/writing
to/from a binary stream. So, the files need to be opened in
text mode for `str` related operations.

Signed-off-by: Yash Nisar <[email protected]>
@yash-nisar
Copy link
Contributor Author

@pombredanne A quick review possible ?

@yash-nisar
Copy link
Contributor Author

yash-nisar commented Mar 4, 2018

Circle CI states that:

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)

Lets see if running brew update does the trick.

@yash-nisar yash-nisar changed the title Fix build failure for Travis and Appveyor #36 Fix build failure for Travis, Appveyor and Circle #36 Mar 4, 2018
@yash-nisar
Copy link
Contributor Author

@a-h-i @sschuberth Would you like to have a look ?

@@ -1,5 +1,6 @@
machine:
pre:
- brew update
Copy link
Member

Choose a reason for hiding this comment

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

Please explain in the commit message why this is necessary, because AFAIK brew install does an auto-update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

temp_dir = tempfile.mkdtemp(prefix='test_spdx')
result_file = os.path.join(temp_dir, 'spdx-simple.tv')
with open(result_file, 'wb') as output:
with open(result_file, 'w') as output:
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I'm not a Python expert: Will this work for Python 2, too? Because we need to stay compatible to both versions 2 and 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will work on Python 2 too. The tests pass for Python 2.7. :)

Copy link
Member

Choose a reason for hiding this comment

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

Then I'm wondering why it ever worked for Python 3. Do you have any idea about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Python 3 returns 'bytes' and not 'str' when reading/writing to/from a binary stream. So, the files need to be opened in text mode for str related operations.

Copy link

Choose a reason for hiding this comment

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

@sschuberth I guess the answer is in the Travis Builds - If you look at older builds that passed the tests hadn't been added up till then (back when the builds were passing that is)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't realize @pombredanne had committed this directly, without going through a PR that runs CI. Otherwise that change should have never gotten in.

@sschuberth sschuberth mentioned this pull request Mar 5, 2018
@sschuberth
Copy link
Member

Superseded by #38.

@sschuberth sschuberth closed this Mar 6, 2018
@yash-nisar yash-nisar deleted the test_build branch August 12, 2018 14:13
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.

3 participants