Organizing tools with a folder structure

How do you get around the issue of reading data files from within the zip file? For instance, taking a piece of code like this…

import os
import json


def foo():
    """
    Read some data from a json file which side-by-side the module
    :return: 
    """
    data_file = os.path.join(
        os.path.dirname(__file__),
        'bar.json',
    )

    with open(data_file, 'r') as f:
        data = json.load(f)

    return data

Zipping up the foo module and adding the zip path to the sys.path, and calling that method returns this err…

FileNotFoundError: [Errno 2] No such file or directory: 'c:\\pyt\\foo.zip\\foo\\bar.json'

Which I assume is because open() expects a directly accessible folder structure. Its not logic I use too often, but loading stylesheets dynamically onto qt widgets is a good use case.

How do you get around this issue, or do you keep all data separate from source code as a rule?