Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about pkg-resources

Read more about pkg-resources

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - pkg-resources

Load file from same folder as Python 3.x script inside package

Opening and loading data from a file that is situated in the same folder as the currently executing Python 3.x script can be done like this: import os mydata_path = os.path.join(os.path.dirname(__fil...
test-img

Mr. Developerdude

python

file

loading

python-packaging

pkg-resources

Votes: 0

Answers: 1

Latest Answer

You can use importlib.resources.read_text in order to read a file that's located relative to a package: from importlib.resources import read_text data = read_text('mypkg.foo', 'mydata.txt')
test-img

a_guest

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved