Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

fs.makedirs() fails unless you put a file in the folder (shared drive)

Đang mở
#349 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api, cloud

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ví dụ về ổ đĩa dùng chung với GDriveFileSystem.makedirs(), sau đó kiểm tra entry point makedirs và logic tạo thư mục của nó. Được xem là hoàn tất khi tạo đệ quy test_parent/test, hoặc đường dẫn lồng nhau tương đương, mà không tạo tệp trước; hãy thêm hoặc chạy một regression test nếu repository có cung cấp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Example:

# Setup
from pydrive2.fs import GDriveFileSystem
from pydrive2.auth import GoogleAuth

settings = {
    "client_config_backend": "service",
    'service_config': {
        'client_json_dict': {
            "type": "service_account",
            "private_key_id": str(os.getenv('xxx')),
            "private_key": str(os.getenv('xxx')).replace('\\n', '\n'),
            "client_email": str(os.getenv('xxx')),
            "client_id": str(os.getenv('xxx')),
        },
    'oauth_scope': [
        'https://www.googleapis.com/auth/drive',
        'https://www.googleapis.com/auth/drive.metadata'
    ]
    }
}

g = GoogleAuth(settings=settings)
g.ServiceAuth()
shared_d_name = "xxx"

fs = GDriveFileSystem(
    shared_d_name,
    google_auth=g
)


# Example that does not recursively create folders, and no exceptions raised
folder_path = f'{shared_d_name}/test_parent/test'
fs.makedirs(folder_path)

# Example that creates the folders
folder_path = f'{shared_d_name}/test_parent2/test2'
fs.makedirs(folder_path)
with fs.open(folder_path+'hi.txt', 'w') as f:
    f.write('hi')

Easy to make and then delete the file as a workaround, but the lack of success in the first example was wierd.
Best,
T

Ngôn ngữ chính
Python
Star
668
Fork
75
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của iterative/PyDrive2

Tất cả issue của iterative/PyDrive2

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.