416
❘
CHAPTER 19
Using ironPython with Mono
FIgURE 19-7:
Mono doesn’t provide any debugging support that
Visual Studio understands.
If you really do need Mono debugging, then you should consider adding Mono
support to Visual Studio or using one of the alternative Mono IDEs. The “An
Overview of the Mono Family” section of this chapter provides additional
details about these alternatives.
To start the application successfully, choose Debug
➤➤➪➤➤
Start Without Debugging or press Ctrl+F5.
The program will run normally and you’ll see the usual message at the end. Pressing Enter displays
a second pause as shown in Figure 19-8. It seems that Mono provides its own pause so that you can
see the results of executing the program, which is a nice touch for those times when you forget to
add a pause of your own.
FIgURE 19-8:
IronPython displays the list of modules found in the current setup.
548592c19.indd 416
2/24/10 12:49:53 PM
www.finebook.ir
Creating an IronPython Application with Mono
❘
417
Running the Application from the Command Line
Interestingly enough, Mono does come with direct support for IronPython, but Mono supports
IronPython 1.1, and the IronPython console supplied with Mono seems to do odd things. Open a
Mono command prompt, type IPY, and press Enter. When you see the IronPython prompt, you’ll
see that it differs considerably from the one used throughout the book. Now try typing 1+1 and
pressing Enter. You’ll probably see results like those in Figure 19-9.
FIgURE 19-9:
The IronPython console provided with Mono leaves a lot to be desired.
Of course, the question isn’t about the IronPython console, but whether it can run the example appli-
cation. Press Ctrl+C to break out of the mess you’re seeing onscreen. Type Y and press Enter when
you’re asked whether you want to stop the batch file. Then type
IPY TestMono.py
and press Enter.
You’ll see that the application does indeed work, as shown in Figure 19-10. The number of modules is
far smaller than the list shown in Figure 19-8, but it’s correct for the version of IronPython provided
with Mono.
FIgURE 19-10:
You can run the test application using the Mono version of IronPython.
The picture isn’t completely gloomy. Developers are constantly trying new solutions for working with
IronPython. You can find a potential fix for the problems described in this section of the chapter at
http://ironpython-urls.blogspot.com/2009/06/mono-can-now-compile-ironpython-20
.html
. The solution comes with the caveat that it might not work for you.
548592c19.indd 417
2/24/10 12:49:53 PM
www.finebook.ir
Do'stlaringiz bilan baham: |