SyntaxError unicode error unicodeescape codec can t decode bytes in position 2-3 truncated UXXXXXXXX escape

0 votes
This is my code, i want python to make put all kinds of folders in the folder i made with the module os but it gives the error...

import os

main_folder = "C:\Users\marin\OneDrive\Documenten\jaar 2\Practicum 2\E shell"

if not os.path.exists(os.path.join(main_folder, "Bias")):

    os.mkdir(os.path.join(main_folder, "Bias"))

if not os.path.exists(os.path.join(main_folder, "Dark")):

    os.mkdir(os.path.join(main_folder, "Dark"))

if not os.path.exists(os.path.join(main_folder, "LED")):

    os.mkdir(os.path.join(main_folder, "LED"))

if not os.path.exists(os.path.join(main_folder, "Orders")):

    os.mkdir(os.path.join(main_folder, "Orders"))

if not os.path.exists(os.path.join(main_folder, "Thar")):

    os.mkdir(os.path.join(main_folder, "Thar"))

if not os.path.exists(os.path.join(main_folder, "Tungsten")):

    os.mkdir(os.path.join(main_folder, "Tungsten"))

if not os.path.exists(os.path.join(main_folder, "Calibration")):

    os.mkdir(os.path.join(main_folder, "Calibration"))

if not os.path.exists(os.path.join(main_folder, "Calibration/x_pos")):

    os.mkdir(os.path.join(main_folder, "Calibration/x_pos"))

if not os.path.exists(os.path.join(main_folder, "Calibration/wavelength_thar")):

    os.mkdir(os.path.join(main_folder, "Calibration/wavelength_thar"))

if not os.path.exists(os.path.join(main_folder, "Calibration/x_wavelength")):

    os.mkdir(os.path.join(main_folder, "Calibration/x_wavelength"))

if not os.path.exists(os.path.join(main_folder, "Object")):

    os.mkdir(os.path.join(main_folder, "Object"))
Nov 17, 2021 in Python by Marinde
• 120 points
1,065 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

This error occurs because you are using ...READ MORE

answered Sep 9, 2020 in Python by Gitika
• 65,910 points
13,673 views
0 votes
3 answers

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

You are getting this error because you ...READ MORE

answered Dec 31, 2019 in Python by Kalgi
• 52,360 points
99,009 views
0 votes
2 answers

Error: Speech to Text Codec cannot decode the bytes in position

import speech_recognition as sr r = sr.Recognizer() audio ='C\Users\Desktop\audiofile1.wav' with ...READ MORE

answered Nov 28, 2018 in Python by Nabarupa Das
2,471 views
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

answered Jun 28, 2019 in Python by anonymous
13,313 views
+2 votes
2 answers

UnicodeDecodeError: "utf-8" codec can't decode byte in position : invalid start byte

You have to use the encoding as latin1 ...READ MORE

answered Jul 23, 2019 in Python by Kunal
242,914 views
0 votes
0 answers

utf-8' codec can't decode byte 0xa0 in position 10: invalid start byte

my code import wordcloud import numpy as np from matplotlib ...READ MORE

Mar 29, 2020 in Python by anonymous
• 120 points
5,005 views
0 votes
2 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 16: invalid start byte

Thanks, This answer was helpful. READ MORE

answered Jul 11, 2020 in Python by Prashant Chhatrashali
15,722 views
0 votes
1 answer

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

Hi, @hala, Regarding your query, you can go ...READ MORE

answered Jun 29, 2020 in Python by Niroj
• 82,880 points
17,029 views
+1 vote
1 answer

'utf-8' codec can't decode byte 0xa9 in position 12527: invalid start byte

Hello, You can always safely read in binary ...READ MORE

answered Jun 30, 2020 in Python by Niroj
• 82,880 points
13,528 views
0 votes
1 answer

'utf-8' codec can't decode byte 0x82 in position 16: invalid start byte

Hi@zena, The error is because there is some non-ASCII ...READ MORE

answered Jun 29, 2020 in Python by MD
• 95,440 points
14,772 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP