Due to changes in the new version of IPython, CASA 5.1 no longer includes the current directory in the PYTHONPATH. In the previous versions of CASA, to import a file named "xxx.py" from the current directory, one would merely type in CASA:
import xxx
That no longer works because the current directory is not searched as a possible location for Python files. So, you must now add the current directory to the PYTHONPATH. This may be done by including in your .casa/init.py file a line calling the sys.path.append() function with two single quote characters (not a double quotation mark) as the argument:
sys.path.append('')
Alternatively, after starting CASA, one could simply issue a command to update the path by typing
import sys
sys.path = [''] + sys.path
where the characters within the brackets are again two single quotes representing the empty string, which means "current directory" to Python.
Why can't I import Python modules from my current directory into CASA 5.1? - Knowledgebase / CASA - NRAO Science Helpdesk
Why can't I import Python modules from my current directory into CASA 5.1?
Authors list
- Last updated: Nov 1, 2023 by chris obrien