atom-community / atom-community/atom-script

Execute python script with relative imports

Open
#1,390 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

Hi,
I tried to search for a related issue but couldn't find one, apologies if that was already answered.
Can atom-script readily be configured to run python scripts that use relative imports of the form
```python
from .X import A
```
which are executed in the terminal using the command (e.g.)
```bash
python -m package.module
```
rather than the usual
```bash
python package/module.py
```
at the root of the project.

Since this involves modifying the filename used by script, it's not just a matter of configuring script's run options.

I guess if it's not supported, it's just a matter of slightly modifying the grammar used to execute python code to allow for the replacement of the `/`s with dots, but I would have to dabble into the sources in that case.

Thanks in advance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.