Sublime Forum

Running on Mac for first time

#1

Not sure why I’m getting an error here. I installed package control/REPL etc. It works on PC. Thoughts?

favorite_numbers = {
	'jen': 5,
	'rich': 7,
	'steve': 9,
	'charles': 11,
	'ash': 1,
}

for name, number in favorite_numbers.items():
	print(f"{name.title()}'s favorite number is {number}.") 
File "/Users/thedude/Documents/Sublime_Text/PCC_Chp6_Dict1.py", line 19
    print(f"{name.title()}'s favorite number is {number}.")
                                                         ^
SyntaxError: invalid syntax
0 Likes

#2

That’s running fine for me on Linux with both python 2 and 3. Have you tried just running the file from the command line? (btw macs are also PCs - personal computers - though I assume you’re specifically referring to Windows)

0 Likes

#3

Thanks for the reply. Yes, correct it works on a Windows 10 machine running sublime but not on this new MacBook Pro.

I’m not familiar with terminal nor IDLE.

IDLE gave me what seemed to be a formatting error.
SyntaxError: multiple statements found while compiling a single statement
And when I messed with it, it stopped building anything at all.

This is from sublime settings.
{
“bootstrapped”: true,
“in_process_packages”:
[
],
“installed_packages”:
[
“10% Too Dull for My Tastes Color Scheme”,
“1337 Color Scheme”,
“Package Control”,
“SublimeREPL”
]
}

It’s giving me the same error in REPL…

thanks in advance.

0 Likes

#4

I properly formatted your first post. I had assumed the syntax error was with the print as that’s where the chevron was pointing, but it’s actually with the ". You’re using python 2 but your code required python 3.

0 Likes

#5

option shift [ = ”
that sucks

but that just throws a different error.

SyntaxError: Non-ASCII character ‘\xe2’ in file /Users/thedude/Documents/Sublime_Text/PCC_Chp6_Dict1.py on line 19, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

but it also shows

[path: /Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

So I’m running version Python 3.9

I’ll have to look into this more
thx again

0 Likes