Skip to content

Function or Command Suddenly Stops Working

Hal Snyder edited this page Nov 10, 2017 · 1 revision

This page may help if something in your project that used to work suddenly stops working.

Python function stops working

Problem: You have been using plot() in a Sage worksheet, like this:


and getting the usual sine curve. Suddenly, you execute a call to plot() and get the following:

TypeError: 'Graphics' object is not callable

What has happened? The most common reason for a function to stop working is that its name has been inadvertently been reassigned, for example, in some other cell in the worksheet, the following has happened:

plot = line(data_points) # XXX - suppresses plot() function

Solution: Restart your worksheet (or type reset('plot')). Then don't overwrite plot.

Of course, this problem can happen with user-defined functions as well as built-in functions.

System command stops working

Another way things can get overwritten is at the level of system commands.

Problem. Sage command or Sage worksheets start showing strange failures. Many functions work, but some are failing with missing or incompatible library errors, etc.

You may done one of the following and forgot to reset to system default:

  • put a custom Sage executable at ~/bin/sage
  • selected a development Sage executable by doing sage_select develop

Solution: For the above cases, respectively:

  • remove or rename the entry at ~/bin/sage
  • run sage_select 8.0 (or whatever the current version of sage is)

Access to the Ubuntu terminal gives flexibility, but requires caution. If you make customizations in a project, you might want to check settings occasionally to make sure you still want them all. Things to check for customizations you might have added include:

  • system commands superseded in ~/bin
  • python packages locally installed in ~/.local/lib/...
  • shell aliases or functions overwriting system commands from startup files such as ~/.bash_aliases; check these by running the bash command aliases and typeset -F; note that by default, CoCalc defines a large number of bash functions at login, but most of these have names beginning with a single or double underscore.

It can be helpful to put a message in your ~/.bash_aliases as a reminder of customizations and update it when you make changes, for example:

# in ~/.bash_aliases
echo "My customizations in this project: sage_develop, custom version of pyexpect"
Clone this wiki locally
You can’t perform that action at this time.