Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:29:34+00:00 2026-05-29T23:29:34+00:00

Well, I’m playing with pyYAML. I installed the version for Python 2.7 with the

  • 0

Well, I’m playing with pyYAML. I installed the version for Python 2.7 with the Windows installer.

It imports just fine:

import yaml

and it throws no errors.

But, if I do this:

import yaml

f = open("sets.yml")
dataMap = yaml.load(f)
f.close()

print dataMap

It throws an attribute error and says ‘module’ object has no attribute ‘load’.

I tried dump, and got the same thing. Also same thing for importing like this:

from yaml import load

Anyone have any ideas?

Oh, and also, I thought it was weird — whenever I run the script, it created a .pyc of it. Why is that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:29:36+00:00Added an answer on May 29, 2026 at 11:29 pm

    If another file named yaml.py is on your sys.path BEFORE the actual PyYaml library, you’ll pick up and import that yaml.py file. This includes if you’ve named your own file yaml.py.

    The fact that you’re getting yaml.pyc in your directory indicates that this is exactly what you’re doing. Your import yaml statement is loading in your own yaml.py file, which causes the interpreter to compile it to yaml.pyc for more efficient running.

    Rename the yaml.py file in your directory. Do not name any python file you’re working on with the same name as any existing python module you’re using, as a general rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well the subject is the question basically. Are there any version control systems out
Well, i've got a nice WPF book its called Sams Windows Presentation Foundation Unleashed.
Well behaved windows programs need to allow users to save their work when they
well I think I know what the problem is. I am just having a
Well, I just started to work on server side scripting , I chose PHP,
Well, this one is my XML file <?xml version=1.0 encoding=utf-8?> <config> <setup> <Test>10</Test> <Copy>
Well if i want to store data for a application machine wide i just
Well, I want to check the version of a site (this part I know
Well, after a long time writing .net programs in C# I started to feel
Well, this is my first post here and really enjoying the site. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.