×
Namespaces

Variants
Actions
Revision as of 08:56, 6 February 2012 by hamishwillee (Talk | contribs)

Archived:How to execute a PySymbian script

From Nokia Developer Wiki
Jump to: navigation, search


Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Platform Security
Capabilities: )
Article
Keywords: execfile
Created: bogdan.galiceanu (20 Feb 2008)
Last edited: hamishwillee (06 Feb 2012)

Contents

Overview

This snippet shows how to execute a script in Python.

Source code

file_path = "C:\\python\\ball.py"
#The path of the script to be executed
 
#Execute the script
execfile(file_path)

Postconditions

The script is executed.

Additional information

In some cases there may be a NameError error in the executed script regarding variables not being defined (for example, if execfile(file_path) is called inside a function). To overcome this, execfile(file_path, {}) should be used, where the dictionary is the global namespace.

76 page views in the last 30 days.
×