On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 <ryanshu...@gmail.com> wrote: > I'm trying to run this script (using IDLE 3.4)
> I would be most appreciative if someone could respond to a few questions. > > The error that I get is this. > 'invalid syntax' You may get better help if you give the context of this message. > The second single quote in this line is highlighted pink. > print 'Downloading data from Yahoo for %s sector' % sector > > #1) That's very bizarre to mix single quotes and double quotes in a single > language. Does Python actually mix single quotes and double quotes? I'm not sure what you mean by "mix". C uses single quotes and double quotes, right? Python treats single quotes and double quotes pretty much interchangeably, except if you start a string with a single quote (for example), you can easily put a double quote inside it, and you must terminate the string with another single quote. And vice versa. > #2) In the Python 3.4 Shell window, I turn the debugger on by clicking > 'Debugger'. Then I run the file I just created; it's called 'stock.py'. I > get the error immediately, and I can't debug anything so I can't tell what's > going on. This is very frustrating. All the controls in the debugger are > greyed out. What's up with the debugger? You have Python 2.x code there. The differences between 2.x and 3.x are far from insurmountable, but it does require a little code adjustment. If you're a python novice, you might be better off running this under 2.x. I believe your debugger won't help until your code compiles. > #3) My final question is this? How do I get this code running? It seems > like there is a problem with a single quote, which is just silly. I can't > get the debugger working, so I can't tell what's going on. The only thins I > know, or I think I know, is that the proper libraries seem to be installed, > so that's one thing that's working. The print statement in 2.x has been made a print function in 3.x; that's likely necessary to fix, though not necessarily sufficient. EG in 2.x: print 'hello word', 6 while in 3.x that would be: print('hello world', 6) Interestingly, you can write a single command that works in both with: print('hello world {}'.format(6)) To 2.x, it's printing the result of a parenthesized expression. To 3.x, it's a function call with one argument. > I'd really appreciate it if someone could please answer my questions and help > me get this straightened out, so I can have some fun with Python. So far, > I've spent 2 months reading 4 books, and trying all kinds of sample > code...and almost every single thing fails and I have no idea why. You may also need to install pytz, pandas and BeautifulSoup. I favor pip or pip3 for such things. -- https://mail.python.org/mailman/listinfo/python-list