Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTerri Valentine
23,034 Points``import pathlib def get_root(): root = pathlib.PurePath( input("What's the full path where you'd ``
What is wrong with this code for the challenge builder.py?
I got Bummer! Couldn't import get_root.
import pathlib
def get_root():
root = pathlib.PurePath(
input("What's the full path where you'd like the project? ")
)
if not root.is_absolute():
return get_root()
return root
def main():
project_root = get_root()
project_name = None
while not project_name:
project_name = input("What's the full name for the project?").strip()
print("Creating {} in {}".format(project_name, project_root))
if _name_ == '_main_':
main()
1 Answer
Steven Parker
231,275 PointsIt doesn't look like you've changed "get_root" yet. But perhaps more significant, it looks like there's a lot of added code outside of the function that isn't related to the challenge.
For this challenge, you'll make a small modification to the provided "get_root" function. You won't add any code outside of the function.
Terri Valentine
23,034 PointsTerri Valentine
23,034 PointsI am a coding newbie, how do I modify the get_root? Does it have to be changed to a string? If so, how do you change it to a string?
Steven Parker
231,275 PointsSteven Parker
231,275 PointsThe instructions say "... if the path is relative, change it into an absolute path.". You won't need to convert anything into a string, you can do this using methods from the "pathlib" library. You might need to look over the library documentation a bit to get familiar with it.
Also, depending on how much of a "newbie" you are, you might want to take some other courses before this one, even though it's classed "beginner" level. I would recommend that beginners start with the Learn Python track.