Repository: ManimCommunity/manim

Issue:
With no scene specified on CLI, manim gives false choice.
I was running the command:
`manim -pl --media_dir ~/renderings ~/dev/manim/example_scenes/basic.py ` 
and was greeted by this:
```

[19:29:42] INFO     Read configuration files:                                                                      config.py:416
                    ['/home/cobordism/.local/lib/python3.8/site-packages/manim/default.cfg']                                    
1: GraphScene
2: LinearTransformationScene
3: MovingCameraScene
4: OpeningManimExample
5: ReconfigurableScene
6: SampleSpaceScene
7: SpecialThreeDScene
8: SquareToCircle
9: ThreeDScene
10: UpdatersExample
11: VectorScene
12: WarpSquare
13: WriteStuff
14: ZoomedScene

Choose number corresponding to desired scene/arguments.
(Use comma separated list for multiple entries)
Choice(s): 

```

Clearly something is wonky here The choices should have been only the scenes from basic.py.
i.e. OpeningManimExample, SquareToCircle, WarpSquare, WriteStuff, UpdatersExample.




Discussion:
What a weird bug. Running manim on `basic.py` works as expected, but on `./basic.py` it doesn't:

```
$ manim -pl basic.py
[09:49:01] INFO     Read configuration files: ['/home/leo/code/manim/manim/default.cfg']                                                                        config.py:416 
1: OpeningManimExample
2: SquareToCircle
3: UpdatersExample
4: WarpSquare
5: WriteStuff

Choose number corresponding to desired scene/arguments.
(Use comma separated list for multiple entries)
Choice(s):
```


```
$ manim -pl ./basic.py 
[10:44:15] INFO     Read configuration files: ['/home/leo/code/manim/manim/default.cfg']                                                                        config.py:416 
1: GraphScene
2: LinearTransformationScene
3: MovingCameraScene
4: OpeningManimExample
5: ReconfigurableScene
6: SampleSpaceScene
7: SpecialThreeDScene
8: SquareToCircle
9: ThreeDScene
10: UpdatersExample
11: VectorScene
12: WarpSquare
13: WriteStuff
14: ZoomedScene

Choose number corresponding to desired scene/arguments.
(Use comma separated list for multiple entries)
Choice(s):
```
I'm at a loss here. Apparently when using `./basic.py`, manim is reading all Scene classes in the scope (which include all those imported with `from manim import *` e.g. GraphScene, ZoomedScene, etc); but when using `basic.py` these don't show up.

Resolving patch:
diff --git a/manim/__main__.py b/manim/__main__.py
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -135,7 +135,9 @@ def get_module(file_name):
             sys.exit(2)
     else:
         if os.path.exists(file_name):
-            module_name = re.sub(r"\..+$", "", file_name.replace(os.sep, "."))
+            if file_name[-3:] != ".py":
+                raise Exception(f"{file_name} is not a valid Manim python script.")
+            module_name = file_name[:-3].replace(os.sep, '.').split('.')[-1]
             spec = importlib.util.spec_from_file_location(module_name, file_name)
             module = importlib.util.module_from_spec(spec)
             spec.loader.exec_module(module)


Test patch: