Thanks for your help. Sorry for posting any unrelated questions. The reason I post in this group is that at beginning I did not know where is the problem of my codes, I guessed that my path settings in Spyder was not correct.
On Saturday, December 20, 2014 4:11:57 PM UTC+1, Adrian Klaver wrote: > > On 12/20/2014 03:03 AM, Lei wrote: > > Thanks a lot for your reply! > > > > I tried your suggestions, but it did not work on my computer. > > > > 1. I think the except following the first try are not performed, since I > > added a code in the except block, it was not shown in the output. > > > > 2. The "exec(init_code)" produced a "None" value, since I modified this > > code to > > ------------------------------------- > > print(exec(init_code)) > > ------------------------------------- > > In the output, the word "None" showed up. So I think, the reason the > > whole try.py file not working is this code "exec(init_code)" just > > produces None. > > Yes. I stay away from exec as much as possible, to 'black box'. I would > take a look at using argparse to catch the arguments passed in; > > https://docs.python.org/3/howto/argparse.html#id1 > > > > > > 3. For the except code following the first try, I changed to > > -------------------------------------- > > except as e > > -------------------------------------- > > but, my computer said it is invalid syntax. > > Which is correct:( My mistake, you cannot do that with a bare except as > it turns out. I should have tested before suggesting it. > > > > > 4. The interest.py file contains much more things that are not directly > > related to this question, so I think it would be clearer to make a > > concentrated file. > > > > 5. The Python tutorial is wonderful, but it is too general. Not specific > > for my question. I have already tried to find my answers in this > > tutorial, but I could not find it. > > > FYI this list is really for questions related to Spyder, not general > Python questions. If you want to continue off-list I will help where I > can. > > > > > > > > > > > > > -- > Adrian Klaver > [email protected] <javascript:> > -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/spyderlib. For more options, visit https://groups.google.com/d/optout.
