I have a module that can also be run from the command line:

    def func()
        print('Hello!')

    if __name__ == '__main__':
        func()

When I try to load it in Sage, the main block is executed:

    sage: load('module.sage')
    Hello!
    sage:

The bigger problem is that my main block parses command line arguments and 
Sage aborts the load with an error because the argument parser didn't 
receive any command line arguments.  Is there any way to handle this?  I 
can preparse `module.sage` and import it as a Python module, but its much 
easier to not have to do this every time I change the module.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to