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

"PRESUBMIT.py" had an exception #46930

Closed
asashour opened this issue Aug 17, 2021 · 7 comments
Closed

"PRESUBMIT.py" had an exception #46930

asashour opened this issue Aug 17, 2021 · 7 comments
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.

Comments

@asashour
Copy link
Contributor

asashour commented Aug 17, 2021

On trying

git cl upload -s

There is an error

Running Python 2 presubmit upload checks ...
"C:\use\dart-sdk\sdk\PRESUBMIT.py" had an exception.
invalid syntax (PRESUBMIT.py, line 75)
Maybe your depot_tools is out of date?

I have downloaded the latest depot_tools on Windows, however, it seems it still users Python 2 and I assume the commit d2bd43f forces Python 3.

set USE_PYTHON3=True doesn't have an effect before git cl upload -s

C:\>where python
C:\use\depot_tools\python.bat

C:\>python
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32

which seems to come from

C:\use\depot_tools\bootstrap-2@3_8_10_chromium_20_bin\python\bin
@vsmenon vsmenon added the area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes. label Aug 18, 2021
@athomas
Copy link
Member

athomas commented Aug 18, 2021

@asashour Do you have python3 installed as well?

@asashour
Copy link
Contributor Author

Yes, python3 is installed, and even after putting it at the beginning of the PATH, the same error.

image

C:\use\flutter\clone\dart-sdk\sdk>git cl upload -s
Running Python 2 presubmit upload checks ...
"C:\use\flutter\clone\dart-sdk\sdk\PRESUBMIT.py" had an exception.
invalid syntax (PRESUBMIT.py, line 75)
Maybe your depot_tools is out of date?

C:\use\flutter\clone\dart-sdk\sdk>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

@athomas
Copy link
Member

athomas commented Aug 19, 2021

It shouldn't fail in the Python 2 presubmit upload checks because the PRESUBMIT.py file contains USE_PYTHON3 = True line. Can you verify that this line is in PRESUBMIT.py in your checkout?

Also, try running update_depot_tools, git pull (or some other command to ensure that your checkout is on the most recent revision) and gclient sync.

@athomas
Copy link
Member

athomas commented Aug 19, 2021

FYI, I know of at least one developer on Windows that doesn't suffer this particular issue. That's why I'm trying to troubleshoot your setup.

@athomas
Copy link
Member

athomas commented Aug 19, 2021

Found a potential fix, adding USE_PYTHON3: True to codereview.settings might fix this (though I can only reproduce the issue if I remove the USE_PYTHON3 = True from PRESUBMIT.py).

@asashour
Copy link
Contributor Author

Thanks for your feedback. I am using the latest master, and yes the line in PRESUMIT.py is there and the history is correct. update_depot_tools and gclient sync were also executed.

Indeed, putting the line in codereview.settings fixes the issue (tested in a test branch), however I can't commit that in other changes.

image

@athomas
Copy link
Member

athomas commented Aug 24, 2021

I have a CL that changes this in the SDK: https://dart-review.googlesource.com/c/sdk/+/211001

This doesn't really explain your issues, but we want to do this anyway because it will apply to future presubmit scripts as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.
Projects
None yet
Development

No branches or pull requests

3 participants