Open natesonline opened 1 month ago
Hmm, '\U0001f930' See: https://www.iemoji.com/view/emoji/2315/smileys-people/pregnant-woman
How do you out an Emoji in a filename?
I'll investigate.
Ross Scroggs @.***
On Oct 9, 2024, at 12:08 PM, natesonline @.***> wrote:
Google Drive filenames allow lots of special characters, the python script fails with the below if it runs into one. Ran into A with a macron, some alt code emote, etc.
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f930' in position 100: character maps to
— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAM-Scripts3/issues/21, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL5IKSZNGPLWDUCZWO3Z2V5KBAVCNFSM6AAAAABPVGHRS2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3TMNZTGM2TEMA. You are receiving this because you are subscribed to this thread.
Send me a Meet/Zoom invitation so I can get more info about how to solve the problem.
Ross Scroggs @.***
On Oct 9, 2024, at 12:21 PM, Ross Scroggs @.***> wrote:
Hmm, '\U0001f930' See: https://www.iemoji.com/view/emoji/2315/smileys-people/pregnant-woman
How do you out an Emoji in a filename?
I'll investigate.
Ross
Ross Scroggs @.***
On Oct 9, 2024, at 12:08 PM, natesonline @.***> wrote:
Google Drive filenames allow lots of special characters, the python script fails with the below if it runs into one. Ran into A with a macron, some alt code emote, etc.
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f930' in position 100: character maps to
— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAM-Scripts3/issues/21, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL5IKSZNGPLWDUCZWO3Z2V5KBAVCNFSM6AAAAABPVGHRS2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3TMNZTGM2TEMA. You are receiving this because you are subscribed to this thread.
Windows Key + period key brings up Windows Emoji keyboard. I guess Google accepts it. I think I overwrote my original output CSV with my manual removal of spec chars. Let me see if I can dig it up quick and share some samples. I'll get back to you.
I need to see the file name: gam user @.*** show fileinfo <IDOfEmojiFile" fields id,name
Ross Scroggs @.***
On Oct 9, 2024, at 12:43 PM, natesonline @.***> wrote:
Windows Key + period key brings up Windows Emoji keyboard. I guess Google accepts it. I think I overwrote my original output CSV with my manual removal of spec chars. Let me see if I can dig it up quick and share some samples. I'll get back to you.
— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAM-Scripts3/issues/21#issuecomment-2403298302, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLYWNXWLCG73SOFH7UTZ2WBMTAVCNFSM6AAAAABPVGHRS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBTGI4TQMZQGI. You are receiving this because you commented.
example.spec.chars.csv Here's 3 that I pulled and hopefully censored enough.
Ross Scroggs @.***
On Oct 9, 2024, at 1:16 PM, natesonline @.***> wrote:
example.spec.chars.csv https://github.com/user-attachments/files/17318158/example.spec.chars.csv Here's 3 that I pulled and hopefully censored enough.
— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAM-Scripts3/issues/21#issuecomment-2403350797, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLZSTAWIR23Y5DKTRNLZ2WFJFAVCNFSM6AAAAABPVGHRS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBTGM2TANZZG4. You are receiving this because you commented.
`censored,1TDsEAvzKVXBgd4yanSYL4,BIF MAMA OUTLINE,application/vnd.google-apps.document,id:anyoneWithLink,reader,False
File "C:\Users\user\Downloads\GetSharedWithAnyoneDriveACLs.py", line 67, in
'driveFileId': row['id'],
^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
'role': row[f'permissions.{permissions_N}.role'],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'allowFileDiscovery': allowFileDiscovery})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\csv.py", line 226, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f930' in position 100: character maps to <undefined>
`
Try this, GAM is now powerful enough to not need the script
# Get Shared witn Anyone ACLS
gam config auto_batch_min 1 num_threads 10 redirect csv ./SharedWithAnyonePerms.csv multiprocess redirect stderr - multiprocess all users print filelist fields id,name,basicpermissions,mimetype query "(visibility='anyoneCanFind' or visibility='anyoneWithLink')" pm type anyone em pmfilter oneitemperrow
# If desired, delete the ACLs
gam csv SharedWithAnyonePerms.csv gam user "~Owner" delete drivefileacl "~id" "id:~~permission.id~~"
Great stuff, tested on my end. Works well. Unfortunately, I'm running only against suspended users and have already deleted the special char files, so in reality I've only tested the new code in GAM, nothing specific to the reported issue with special chars.
Send me a Meet/Zoom invitation
Ross Scroggs @.***
On Oct 10, 2024, at 12:54 PM, natesonline @.***> wrote:
Great stuff, tested on my end. Works well. Unfortunately, I'm running only against suspended users and have already deleted the special char files, so in reality I've only tested the new code in GAM, nothing specific to the reported issue with special chars.
— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAM-Scripts3/issues/21#issuecomment-2405919616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLZ7JE46IXL2BVFKRSLZ23LODAVCNFSM6AAAAABPVGHRS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBVHEYTSNRRGY. You are receiving this because you commented.
Sent you an email.
Below is GAM output you requested that I realized I missed. This is the filename for the \U0001f930 .
gam user user@user.com show fileinfo 1nsSIk7MmbSLuG80 fields id,name
User: user@user.com, Show 1 Drive File/Folder Drive File: - - BIG* MAMA OUTLINE 🤰 (1nsSIk7MmbSLuG80) id: 1nsSIk7MmbSLuG80 name: - - BIG* MAMA OUTLINE 🤰
I did forget that I could just re-add the ACL to one of the problem files. So I did that and ran the two commands you mentioned against one same file with the \U0001f930. Everything ran fine no errors.
Google Drive filenames allow lots of special characters, the python script fails with the below if it runs into one. Ran into A with a macron, some alt code emote, etc.
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f930' in position 100: character maps to