Skip to content

Commit 3507e7f

Browse files
authored
Update README.md
1 parent 3466153 commit 3507e7f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
# runpythonvirtual
22
It’s a basic Nim wrapper to run Python scripts with a hardcoded interpreter in the same shell while forwarding arguments transparently.
3+
4+
# 📜 Description of the Current Program
5+
6+
This Nim program is a simple Python launcher:
7+
8+
### Hardcoded Executable Path
9+
10+
The path to the Python interpreter inside the virtual environment is written directly into the code.
11+
12+
```
13+
Example (Windows):
14+
15+
const exePath = r"C:\Programs\PythonVirtualEnv\tuivirtual\Scripts\python.exe"
16+
```
17+
18+
### Command-Line Argument Forwarding
19+
20+
When you run the Nim program with arguments, it forwards them to the Python executable.
21+
22+
```
23+
Example:
24+
25+
runpython.exe myscript.py arg1 arg2
26+
```
27+
28+
internally runs:
29+
```
30+
C:\Programs\PythonVirtualEnv\tuivirtual\Scripts\python.exe myscript.py arg1 arg2
31+
```
32+
33+
### Process Execution in Current Shell
34+
35+
- It uses ```startProcess(exePath, args=args, options={poParentStreams})```.
36+
37+
- This runs the Python script inside the same shell session as the Nim program, sharing stdin/stdout/stderr.
38+
39+
- That means no new window/terminal is opened; it just executes inline.
40+
41+
### Output Handling
42+
43+
- Because {poParentStreams} is used, all Python output is visible in the same console window.
44+
45+
- The program waits for Python to finish, then prints "Process finished.".
46+
47+
### ⚡ Example Run
48+
```
49+
nim c -r runpython.nim myscript.py
50+
```

0 commit comments

Comments
 (0)