Skip to content

Subfolder added to the root of google drive + TypeError: expected str, bytes or os.PathLike object, not list  #1

@MagTun

Description

@MagTun

Hi,

Thanks for sharing your code!

I tried the upload_to_drive.py. The folder is uploaded to my google drive, but:

  • the subfolders are uploaded to the root of my drive (not under the parent folder) and their are renamed (cf below)
  • after the first upload, if the content of the local folder is modified, then I get the error below, and the sync doesn't happen. (I also get this error when I upload the folder for the first time but the files/fodler are nonetheless uploaded

I have python 3.6.1

Traceback (most recent call last):
  File "C:\Users\Me\Desktop\upload_to_drive.py", line 376, in <module>
    main()
  File "C:\Users\Me\Desktop\upload_to_drive.py", line 249, in main
    var = os.path.join(full_path.split(os.path.sep)[0:-1]) + os.path.sep
  File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\ntpath.py", line 75, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not list

My local folder structure:

folder 1
   folder 1.1
     folder 1.1.2 
        file A
   folder 1.2
   file B
   file C

The folder structure on Mydrive (notice the subfolders are renamed to parentfolder\parentfolder...):

folder 1
folder 1\folder 1.1
folder 1\folder 1.1\folder 1.1.2 
   file A
folder 1\folder 1.2
   file B
   file C

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions