Google Help Any Programmers?
We need need to update our student Google Profile Photos like we do in Blackbaud, but Google does not have a bulk option. I found an App to connect, but first I need to change the name of the photo files to the student's email address. I found a script to run on my MAC in Terminal to bulk change the name of my files from a CSV, but when I run it I get an error this error:
zsh: parse error near `)'
I changed "George" to my username. What am I missing? I do not know how to write programming. THANK YOU IN ADVANCE!!!!
os.chdir('/Users/George/Desktop/untitled folder')
# Rename from name in col 1 to name in col 2 in CSV File)
with open('/Users/George/Desktop/Book1.csv') as f:
lines = csv.reader(f)
for line in lines:
try:
os.rename(line[0], line[1])
except:
print(line[0] + ': File not found')
Comments
-
@Josceline Reardon Do you have this in a .py file? You can create a plain text file in TextEdit and paste the following code below, update the username, and save it as something like changeFilename.py to your desktop.
Once you have the file set up, you can run it in Terminal by typing:
cd ~/Desktop
python changeFilename.py
0 -
@Troy Burki
Thank you so much for reaching out I have absolutely no programming experience, just trying to muddle my way through to get this figured out.So I typed what you provided in Text Editor, changed the USERNAME to “jreardon” and then renamed it “changefilename.py” (I read I could just change the txt to the python py extension).
Terminal asked for access to my desktop, I approved and then I got this error below (this was further than I got before!!)
I uploaded the txt file (it wouldn't let me upload .py) and also my test csv file if you have time to take look. Thank you so so much! Happy Friday!
jreardon@AirofJoeReardon ~ % cd ~/Desktop
python changeFilename.py
File "changeFilename.py", line 1
1 import os
^
SyntaxError: invalid syntax
jreardon@AirofJoeReardon Desktop %
UPDATE:
SO I did the close function and then pasted in the function and it seems like it searched for the file. This is the new error.
jreardon@AirofJoeReardon ~ % exit()
function> cd ~/Desktop
python changeFilename.py
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'changeFilename.py': [Errno 2] No such file or directory
jreardon@AirofJoeReardon ~ %
0 -
@Josceline Reardon Hi Josceline, not a problem. From the responses you included, it looks like when you copied the code it also copied the line numbers (first line should just be import os instead of 1 import os). It looks like you have Python 2.7 so I've modified the code to work with that version. If you click view raw in the bottom right corner it will give you just the code to copy. Once you've pasted it in to your changeFilename.txt file and changed the file extension to .py you can open a new Terminal and enter those two commands again.
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 206 bbcon®
- 1.4K Blackbaud Altru®
- 394 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 357 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 646 Blackbaud Grantmaking™
- 561 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 934 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.4K Blackbaud Raiser's Edge NXT®
- 3.6K SKY Developer
- 242 ResearchPoint™
- 118 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 238 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 28 PowerUp Challenges
- 3 (Open) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 778 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

