Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet63/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   59   60   61   62   63   64   65   66   ...   453
FIgURE 2-22: 
The output shows the result of calling the SayHello() function.
INTERACTINg WITH THE IRoNPyTHoN ENVIRoNMENT
At this point, you know how to create basic functions; determine which modules, objects, and 
functions are available for use; and import external modules as needed. The last major basic task 
you need to know about is interacting with the IronPython environment. Knowing this informa-
tion will help you create better applications. The following sections provide an overview of many 
environmental needs you’ll have when using IronPython.
obtaining Version Information
You may find a need to programmatically process the version information for a particular IronPython 
installation. Perhaps your application requires a newer version of IronPython. You can obtain this 
information programmatically using the 
sys.version
attribute. The following code shows a simple 
method for checking the IronPython version.
import sys 
print sys.version
Of course, your concern may revolve around Windows. In this case, you can use
sys.getwindowsversion()
to obtain the information you need. The output is an array
containing the following five values:

Major version

Minor version


lISTINg 2-4 
(continued)
548592c02.indd 40
2/24/10 12:47:23 PM
www.finebook.ir


Using IronPython Constructively
 

 
41
Build


Platform


String describing installation (such as the current service pack)


Changing sys.path Values
The 
sys.path
attribute is an array containing paths to various parts of IronPython. You can
use 
sys.path
to locate or modify the path for IronPython. For example, if you type 
print sys 
.path[0]
and press Enter, you obtain the path for the currently executing application. The standard 
list provides these locations:

Executing application path (blank if the interpreter can’t determine the location)

IronPython library directory


IronPython DLL directory


IronPython executable directory


IronPython site-packages directory


The interpreter always searches these paths, looking for any modules you want to import or other 
resources your application requires. You can add or remove entries as necessary. Chapter 4 tells how 
to work with arrays.

Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish