-
Notifications
You must be signed in to change notification settings - Fork 513
Integrated Console - Failing to Execute GAM #1273
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
Comments
Hi @brentbain, thanks for reporting this! I know you've said the error messages are due to permissions errors, but your screenshot indicates an encoding problem. Do you know how the permissions problem is precipitating that error? |
Also, for us to reproduce this (ideally without needing to download and run |
@rjmholt Thanks for following up... I attempted this multiple times to no avail (both hardcoding permissions on the file and the directory) - as well as delete the oauth2.txt file and then trying to have it recreate the file, which also throws similar errors on the integrated console. Currently, I have set the folder where gam.exe and oauth2.txt live to "Authenticated users - Full Permissions" as well as "Users - Full" - originally, it was just my account with full permissions. The permissions on the folder, according to documentation, need to be that the process executing gam needs to be able to read/create/modify the file, oauth2.txt. Looking deeper into other errors, while none on the GAM forums, there are some other people who have noted python execution errors related to the encoding. All though the same question/problem still comes up - why does the "non-integrated" powershell console in VSCode execute it just fine, and the Integrated Console throw the error? Possibly a duplicate of: |
Sorry for not being more helpful. This is a rather mystifying bug though. 100% agree that the failing in the Integrated Console and not failing in the VSCode console is the categorising feature of where the fault lies. The Integrated Console is a client/server process that communicates by JSON, so was thinking that there might be a process permissions thing going on, if permissions are the part that's not working. But it may be an issue with the console's encoding mechanism instead. I noticed this StackOverflow issue mentions that it has to do with Python not using UTF-8 in Windows console environments. Also seems to be occuring in conda/conda#5448, microsoft/WSL#2009 and docker/compose#2775. Also see this other StackOverflow issue. So maybe try setting the EDITED: Got it wrong and thought you'd said the non-integrated console isn't working... We implement our own host for PowerShell to run in on the server side, which communicates input and output over JSON messages. So that might be where the encoding issue lies. Does using Python3 resolve this (not suggesting you move to it, just helpful to diagnose)? |
I've encountered this as well. The encoding error arising from the client-host JSON structure of the plugin makes sense, insofar as my inexperience in these things can allow. I don't know if it's possible to use Python3 with GAM, as for Windows, it comes in a packed exe. As far as I can tell, I think we might need to ask jay0lee to compile the tool using Python3. |
Has anyone found a viable workaround for this issue? |
This seems like a bug, for sure. I'm wondering what you get when you set the PYTHONIOENCODING:
I think there is a bug on PowerShell Editor Services to properly deal with encoding - as we've been seeing stuff like: |
I finally got an opportunity to test that, and got the same output:
|
@tylerl0706: From what I understand, setting The workaround discussed in PowerShell/PowerShell#3819 (comment) may help. |
Can someone with this issue give this workaround a try that @mklement0 supplied: $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding |
@tylerl0706: In this case I was thinking it's the |
Aha! The workaround @mklement0 mentioned seems to work. Output appears as expected from the GAM tool inside the Powershell Integrated Console. Nice find! Speaking of nice finds, because this thread is about using G Suite tools in Powershell, I feel like I must mention this module I found: https://github.com/scrthq/PSGSuite It's way better than the GAM tool, as it returns actual Powershell objects, so no weirdo CSV parsing or Python encoding to wrangle with. Sorry if this is off topic! |
@WToorenburghEasyMarkit cheers! 😄 |
Closing this issue as resolved |
System Details
$PSVersionTable
:PSVersion 5.1.14393.2189
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2189
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
I am experiencing a problem with the open source project for Google API management. This same tool and powershell code work in ISE as well as when running from the non-integrated powershell console. The tool can be downloaded/installed from here:
https://github.com/jay0lee/GAM
It creates a dos executable which makes Google API calls - allowing powershell to interact with the Google API.
I get error messages returned which ultimately are tied back to permissions on a oauth token file which is stored in the folder where the GAM exe resides. If I run the same command from Powershell ISE - or run it from the non-integrated powershell console, everything works as expected. While I'd normally say this is an issue for GAM, since it works in both ISE and in the non-integrated console that starts up with VSCode, I'm hoping it might be something that can be fixed in VSCode Powershell.

Attached Logs
Follow the instructions in the README
about capturing and sending logs.
1523912748-a1e77963-f824-4a1c-8569-29acac8246f81523912745826.zip
The text was updated successfully, but these errors were encountered: