The VS2008 integration is old, awful, was built by the VS Integration team and not the IronPython team, and based in IronPython 1.0. That version of IronPython predates the `except ... as ...:` syntax, which is why it's a syntax error.
You can run Python Tools for Visual Studio (pytools.codeplex.com) using the free VS 2010 Integrated shell, which is a much better experience if you're only doing Python (mixed projects are a different story - you'll need the full VS 2010 for that). - Jeff On Sun, Feb 5, 2012 at 5:05 AM, Cash <nok...@gmail.com> wrote: > Hi, > > > > I'm getting issues with try / except blocks in VS 2008, particularly with > the following way of catching the errors: > > > > try: > > something > > except Error as e: > > do something with e > > > > > > When I try this directly from the IPY console it works fine: > > > >>>> try: > ... open(fakefile.txt) > ... except NameError as e: > ... print 'E is: ' + `e` > ... > E is: NameError("name 'fakefile' is not defined",) > > > > When entering the same code into Visual Studio 2008, it doesn’t like the > syntax at all and highlights the 'as e' part as a syntax error. > > > > Has anyone seen this before and know a way around it at all please? As it > works in the IPY console and is valid Python, I'm presuming it is a bug > within VS? > > > > Thanks, > > > > B > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > http://mail.python.org/mailman/listinfo/ironpython-users > _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users