ChartDirector 7.0 (Python Edition)

Path Specification


Many ChartDirector APIs expect a path for loading a file. Examples include BaseChart.setBgImage and the CDML <*img*> tag.

By default, ChartDirector assumes the path to be a file system path. If a relative path is used, it will be relative to the "current working directory" determined by the operating system. This may not be the same as the directory that contains the executing code.

You may use BaseChart.setSearchPath to specify other directories to search if a relative path is used.

For web applications, note that a file system path is not the same as a URL path. For example, a leading "/" refers to the root of the file system, not the root of the web document directory. This allows files outside of the web document directory to be used.

Depending on the web server, the "current working directory" may not be the same as the current URL directory. If you would like to load a file relative to the current URL directory, you may use BaseChart.setSearchPath to specify searching the current URL directory for files. For example:

c.setSearchPath(os.path.dirname(sys.argv[0]))