Start a new topic

python builting environment

Original Post by: gmendieta Mon Sep 23 10:31:54 2013


Morning all!!

A quite simple question!!

I cant import modules os and re from within the built-in environment.

Thanks in advance!!

Gorka


Original Post by: ChrisRogers Mon Sep 23 14:58:18 2013


Hi, importing additional modules like the ones you described requires a python install on your machine. Take a look at the documentation to determine the correct version of python to install and the steps required to get this functioning.

Original Post by: gmendieta Mon Sep 23 15:09:48 2013


Hi again. Thanks for your answer Chris. I understand that you need to configure your paths if u want to get access to the openflight python library. I have the opposite problem. I want to execute some scripts inside the python editor, using the builtin python environment within Creator. But i dont know how to have access to some additional modules standard in python, as, as i said, os or re. Maybe i have missed some chapter inside doc.


Thank u again

Original Post by: gmendieta Mon Sep 23 15:36:01 2013


ok, finally i have done something like that to fix the problem. ( just in my case )


import sys

sys.path.append("python_path")

import os


But, of course i have different versions of python installed, how i can see the path of python25 in any computer?? ( a generalized way )


Thanks

Original Post by: SteveThompson Mon Sep 23 16:20:39 2013


I have the opposite problem. I want to execute some scripts inside the python editor, using the builtin python environment within Creator. But i dont know how to have access to some additional modules standard in python, as, as i said, os or re.

You can append to "PATH" as you have done, this will certainly work. Note that when the Python interpreter starts up, it uses the values set for the environment variable PYTHONPATH to append to PATH for you automatically. That is, you could (alternatively) set PYTHONPATH to contain your path and then you could skip the sys.path.append in your script.


But, of course i have different versions of python installed, how i can see the path of python25 in any computer?? ( a generalized way )

There probably won't be an environment variable specifically for this. While there are many ways to do this, one way (as I've mentioned above) is to set PYTHONPATH to include the version of Python you want to use. If this is done, just check the value for env var PYTHONPATH. You could also check the Control Panel ->Programs setting. It will have an entry for Python 2.5 and perhaps show you where it is installed.

Login to post a comment