GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use print() function in both Python 2 and Python 3 by cclauss · Pull Request #722 · googleapis/google-api-python-client

Conversation

@cclauss

@cclauss cclauss commented Jul 21, 2019

Copy link
Copy Markdown
Contributor

Legacy print statements are syntax errors in Python 3 but print() function works as expected in both Python 2 and Python 3. Also fixed some undefined names.

Four undefined names remain...

$ flake8 . --count --show-source --statistics --select=E9,F63,F7,F82

./samples/coordinate/coordinate.py:60:13: F821 undefined name 'build'
  service = build('coordinate', 'v1', http=http)
            ^
./samples/coordinate/coordinate.py:60:44: F821 undefined name 'http'
  service = build('coordinate', 'v1', http=http)
                                           ^
./samples/coordinate/coordinate.py:64:46: F821 undefined name 'FLAGS'
    jobs_result = service.jobs().list(teamId=FLAGS.teamId).execute(http=http)
                                             ^
./samples/coordinate/coordinate.py:64:73: F821 undefined name 'http'
    jobs_result = service.jobs().list(teamId=FLAGS.teamId).execute(http=http)
                                                                        ^
4     F821 undefined name 'build'
4

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cclauss added 2 commits July 21, 2019 13:47
@cclauss
Use print() function in both Python 2 and Python 3
f6e88b5
Legacy __print__ statements are syntax errors in Python 3 but __print()__ function works as expected in both Python 2 and Python 3.
@cclauss
Fix undefined names
873c51e
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 21, 2019
@busunkim96
Merge branch 'master' into modernize-Python-2-codes
f53132b
busunkim96
busunkim96 approved these changes Jul 22, 2019
View reviewed changes

@busunkim96 busunkim96 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you @cclauss!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@busunkim96
busunkim96 merged commit 9fdc2b2 into googleapis:master Jul 22, 2019
@cclauss
cclauss deleted the modernize-Python-2-codes branch July 22, 2019 17:54
tseaver
tseaver reviewed Jul 22, 2019
View reviewed changes
Comment thread googleapiclient/http.py
'Sleeping %.2f seconds before retry %d of %d for %s: %s %s, after %s',
sleep_time, retry_num, num_retries, req_type, method, uri,
resp.status if resp else exception)
resp.status if resp else Exception)

@tseaver tseaver Jul 22, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This change loses the re-bound exception below, which means it loses information about the actual cause.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@busunkim96 busunkim96 mentioned this pull request Jul 22, 2019
Fix http.py: Exception -> exception. #724
Merged
@vorpal-buildbot vorpal-buildbot mentioned this pull request Jul 24, 2019
[requires.io] dependency update on master branch PennyDreadfulMTG/Penny-Dreadful-Tools#6444
Merged
@vorpal-buildbot vorpal-buildbot mentioned this pull request Mar 11, 2020
Update google-api-python-client to 1.7.12 PennyDreadfulMTG/Penny-Dreadful-Tools#7093
Merged
@parthea parthea mentioned this pull request Nov 18, 2020
Add python3 support, pretty print table #560
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@tseaver tseaver tseaver left review comments
@busunkim96 busunkim96 busunkim96 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@cclauss @tseaver @busunkim96 @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.