# os

## Робоча директорія і директорія скрипта

{% code title="test.py" %}

```python
import os

dir_path = os.path.dirname(os.path.realpath(__file__))
print('Директорія скрипта:        ', dir_path)

cwd = os.getcwd()
print('Поточна робоча директорія: ', cwd)
```

{% endcode %}

```
/work/www/proj/cgi-bin > python test.py
```

```
Директорія скрипта:         /work/www/proj/cgi-bin
Поточна робоча директорія:  /work/www/proj/cgi-bin
```

```
/work/www/proj/cgi-bin > cd ..
/work/www/proj > python cgi-bin/test.py
```

```
Директорія скрипта:         /work/www/proj/cgi-bin
Поточна робоча директорія:  /work/www/proj
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olexsyn.gitbook.io/enote/progr/python/modules/os.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
