This happens both in Sage 7.3 on Ubuntu Linux (Chromebook) and in Sage 7.6
on CoCalc.
On Friday, July 7, 2017 at 1:03:15 PM UTC-4, Jacob Bond wrote:
>
>
>
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.