Communities for your favorite technologies. Explore all Collectives Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams Find centralized, trusted content and collaborate around the technologies you use most. Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. Get early access and see previews of new features. I am new to programming, this is actually my first work assignment with coding. my code below is throwing an error: I'm not able to find where the issue is. As it solved the problem, I put it as an answer. Don't use single and double quotes, especially when you define a raw string with r in front of it. The correct call is then or I had a related issue working within Spyder, but the problem seems to be the relationship between the escape character ( "\") and the "\" in the path name Here's my illustration and solution (note single \ vs double \\ ): This is kind of an old question but I wanted to mentioned here the pathlib library in Python3. If you write: or osDir will be the same result. Also if you write it as: you will get back the absolute directory as You can check more for the pathlib library here. I had this problem with Django and it was because I had forgotten to start the virtual environment on the backend. I had a similar issue while working with Jupyter. I was trying to copy files from one directory to another using copy function of shutil. The problem was that I had forgotten to import the package.(Silly) But instead of python giving import error, it gave this error. Solved by adding: I was facing same error with Django Rest Framework, It was nothing to do with UI, still was getting this error. I applied below solution, worked for me. execute below Python manage.py makemigrations It will show missing package. Install missing package and again run below command to make sure if nothing is missed. Python manage.py makemigrations It will resolve your issue. I had the same error though I did not use the path as in your case. The solution to my problem was to install the django-extension package. I was trying to get the file count by sending path through a .robot file to one file count function which was a pyton file, but was getting the same error message. Below is the code And the robot file was like The ${path} was storing the value as 'r"C:/Users/user/Downloads" but it was failing with above error message. The solution I got for this was Updated Robot file: Just updated the path in robot file and moved count=0 inside the loop and it was working good for me. Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more Thanks for contributing an answer to Stack Overflow! But avoid ⦠To learn more, see our tips on writing great answers. Required, but never shown Required, but never shown By clicking âPost Your Answerâ, you agree to our terms of service and acknowledge you have read our privacy policy. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.12.20.20747