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

  • SEARCH
  • Home
  • 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 6819059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:15:12+00:00 2026-05-26T21:15:12+00:00

I pip install -ed the flufl.enum Python package and I noticed that it works

  • 0

I pip install-ed the flufl.enum Python package and I noticed that it works despite missing a flufl/__init__.py module as regular Python packages. Even stranger is this:

>>> import flufl
>>> flufl
<module 'flufl' (built-in)>

I tried to reproduce this creating foo/bar/__init__.py without foo/__init__.py and (predictably) import foo fails. How does flufl do it?

  • 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-26T21:15:13+00:00Added an answer on May 26, 2026 at 9:15 pm

    the magic is done in the flufl.enum-3.2-py2.7-nspkg.pth file, which is put into site-packages by “pip install”:

    import sys,new,os
    p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('flufl',))
    ie = os.path.exists(os.path.join(p,'__init__.py'))
    m = not ie and sys.modules.setdefault('flufl',new.module('flufl'))
    mp = (m or []) and m.__dict__.setdefault('__path__',[])
    (p not in mp) and mp.append(p)
    

    pth files are evaluated at startup. In particular, this file creates a new module named “flufl” and puts it into sys.modules. That also explains why you see it as “built-in”:

    >>> import new
    >>> new.module('foo')
    <module 'foo' (built-in)>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to install mysql-python using: pip install mysql-python the package is being
I understand that one can use pip to install packages from svn etc. ala:
Why can't I use $ sudo pip install facebook-python-sdk even with facebook-python-sdk package in
I've seen it documented that you can install a Github hosting Python package using
I'm using pip with virtualenv to package and install some Python libraries. I'd imagine
Is it possible? When installing pip , install the python packages inside my $HOME
After installing the BitTorrent-bencode package, either via easy_install BitTorrent-bencode or pip install BitTorrent-bencode ,
I am looking for an easy way to install/uninstall Python modules and found pip.
I want to install pip . It should support Python 3, but it requires
OS X, Python 2.7, a fresh virtualenv: virtualenv bar source bar/bin/activate pip install django

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.