# How can i access local directory with pyscript?

**URL:** <https://forum.anaconda.com/t/how-can-i-access-local-directory-with-pyscript/20729>\
**Category:** PyScript\
**Created:** [May 5, 2022, 1:45pm UTC](https://forum.anaconda.com/t/how-can-i-access-local-directory-with-pyscript/20729 "2022-05-05T13:45:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jang\_wooseok](https://avatars.discourse-cdn.com/v4/letter/j/db6015/32.png) [@jang\_wooseok](https://forum.anaconda.com/u/jang_wooseok)\
**Post date:** [May 5, 2022, 1:45pm UTC](https://forum.anaconda.com/t/how-can-i-access-local-directory-with-pyscript/20729/1 "2022-05-05T13:45:55Z")

</div>

hello, all.  
I’m confused about the way pyscript worked. (specially, writing and reading files.)  
I’d appreciate it if you could explain why this happened.

First of all,  
I couldn’t import my custom pakages.

I made python code file on a same directory as html file, and i wanted to use my custom pakages, but it didn’t work.  
So i tried such a path on my html. All of that were not worked.  
/data.py  
./data.py  
\data.py  
.\data.py  
\data.py  
data.py

I did an experiment to know the directory the pyscript is looking at.

```auto
import os

print('start')
print(os.getcwd())

with open('/read_this_text2.txt','wt') as f:
    f.write('hellod')
    print(f.tell())

with open('/read_this_text2.txt','rt') as f:
    text = f.read()
print(text)

```

I run this simple code with pyscript.  
And result is…

 ![result](https://europe1.discourse-cdn.com/anaconda/original/2X/0/0827310a0b3d897aaae864c8da39f52b1678296f.jpeg)

I think, pyscript executed my code, created textfile, and read text.  
(’/home/pyodide’ … this directory is not on my computer. where was that?)  
But, textfile was not on my computer. I searched all the directories but couldn’t find the file.

In case, I changed user name to english, but same thing happened.

I have two questions.

1. Where is kernel of pyscript? Is that on users computer, or virtual filesystem browser made, or somewhere?
2. How can i access local directory with pyscript? os.chdir() is not worked.

Thanks for reading my questions.

---

<div class="post-metadata">

**Author:** ![amitsaha.in](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/amitsaha.in/32/1256_2.png) [@amitsaha.in](https://forum.anaconda.com/u/amitsaha.in)\
**Post date:** [May 7, 2022, 10:15pm UTC](https://forum.anaconda.com/t/how-can-i-access-local-directory-with-pyscript/20729/2 "2022-05-07T22:15:47Z")

</div>

The first two questions and answers here should help you understand the problem you are facing: [Frequently Asked Questions — Version 0.20.0](https://pyodide.org/en/stable/usage/faq.html#frequently-asked-questions)
