Goga
Goga

Reputation: 425

Python error reading directory?

I have the following Python script:

#!/usr/bin/python
import glob, os

os.chdir("/data")
for file in glob.glob("*.gz"):
    print(file)

When I run this script I get error:

Traceback (most recent call last):
  File "python.py", line 3, in <module>
    os.chdir("/data")

Upvotes: 0

Views: 116

Answers (1)

FallAndLearn
FallAndLearn

Reputation: 4135

Check if you have permission to your /data directory. Also check if it isn't in your home directory.

Upvotes: 1

Related Questions