Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MagTun opened this issue Jul 16, 2017 · 2 comments

Comments

@MagTun
Copy link

MagTun commented Jul 16, 2017

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
@MagTun
Copy link
Author

MagTun commented Jul 16, 2017

I solve it, I will post the code tomorrow.

@mgd722
Copy link

mgd722 commented May 14, 2020

i see you fixed this in your PR, but in case anyone else is here and looking for the minimum viable fix, change upload_to_drive.py line 264 from
var = os.path.join(full_path.split(os.path.sep)[0:-1]) + os.path.sep
to
var = os.path.dirname(full_path) + os.path.sep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants