How to move a file to a folder that the code itself created? (python)

0

Good afternoon, guys. I wrote a program so that after the user enters a name, a folder with this name will be created and then a file (from another folder) will be moved to it. The folder is created, but I'm getting an error while trying to move the file.

import os, shutil

digitar = input()

try:
  if not os.path.exists('G:\Meu Drive\help\jordan\2. Contas\'+digitar):
    os.makedirs('G:\Meu Drive\help\jordan\2. Contas\'+digitar)
except OSError:
  print ('Error: Creating directory. ' +'G:\Meu Drive\help\jordan\2. Contas\'+digitar)

shutil.move('G:\Meu Drive\help\3. Apoio\0. Templates\Experiência\Cópia - TEMPLATE.gsheet', 'G:\Meu Drive\help\jordan\2. Contas\'+digitar)
  

OSError: [WinError 87] Incorrect parameter: 'G: \ My Drive \ help \ 3. Support \ 0. Templates \ Experience \ Copy - TEMPLATE.gsheet '- > 'G: \ My Drive \ help \ jordan \ 2. Accounts \ example '

Why am I getting this error if I am calling the variable "type" in the same way I created the folder? Anyone have any tips?

I looked at the following questions, because they were similar to mine, but did not help

link

link

link

    
asked by anonymous 13.11.2018 / 18:05

0 answers