Python setup.py and pkg_resources, refrencing package dataWhat is setup.py?python setup.py uninstallhow to write setup.py for this application structure?need to package jinja2 template for python__init__.py does not find modules in same directorypackaging multiple pre-compiled binary python c extensions(.so, created using SWIG interface)How to access text file in project root from python package under `src/` directoryPython pkg_resources and file access in packagesNew to creating a Python PackagePython Packaging with .pth files

Decision Variable Value from a Set (Gurobi)

How closely correlated is culture to geography?

Knights and Knaves: What does C say?

麦酒 (ばくしゅ) for "beer"

Can anyone give me the reason why music is taught this way?

Why most footers have a background color as a divider of section?

The answer is a girl's name (my future granddaughter) - can anyone help?

Why do Russians sometimes spell "жирный" (fatty) as "жырный"?

Would an object shot from earth fall into the sun?

What is the meaning of first flight and introduction in aircraft production?

Do jackscrews suffer from blowdown?

What is the difference between increasing volume and increasing gain?

Drawing Maps; flat distortion

How to identify whether a publisher is genuine or not?

Job interview by video at home and privacy concerns

Lighthouse Alternatives

How to interpret the challenge rating of creatures?

If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?

What makes a character irredeemable?

How to prove that the quadratic equation has exactly two real solutions

Looking for circuit board material that can be dissolved

Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?

Why does it seem the best way to make a living is to invest in real estate?

Can an untrusted VPN client monitor my network activity?



Python setup.py and pkg_resources, refrencing package data


What is setup.py?python setup.py uninstallhow to write setup.py for this application structure?need to package jinja2 template for python__init__.py does not find modules in same directorypackaging multiple pre-compiled binary python c extensions(.so, created using SWIG interface)How to access text file in project root from python package under `src/` directoryPython pkg_resources and file access in packagesNew to creating a Python PackagePython Packaging with .pth files






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0















I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this



# copy_template.py
def copy_template(destiny):
# Find from static resources
# and Copy the whole template dir
copytree(resource, destiny)



And I have a file structure like this



# The assets dir and template dir actually have content, and I would like to 
# reference them in the package for several reasons.
.
├── assets
│ ├── resource0
│ ├── resource1
│ └── resource2
├── template
│   ├── data
│   ├── img
│   └── assets
├── package
│   ├── __init__.py
│   ├── copytemplate.py
├── Pipfile
├── README.md
└── setup.py



What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py and how to reference the files inside the module.



I tried to use



# setup.py
setup(...
package_data=
"": ["template/*"]


# reference attempt
package_name = __name__.split('.')[0]
print(pkg_resources.resource_listdir(package_name, ''))


But when ever I try to reference I get a traceback for a TypeError so I don't find how to make this work.



any ideas?










share|improve this question
































    0















    I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this



    # copy_template.py
    def copy_template(destiny):
    # Find from static resources
    # and Copy the whole template dir
    copytree(resource, destiny)



    And I have a file structure like this



    # The assets dir and template dir actually have content, and I would like to 
    # reference them in the package for several reasons.
    .
    ├── assets
    │ ├── resource0
    │ ├── resource1
    │ └── resource2
    ├── template
    │   ├── data
    │   ├── img
    │   └── assets
    ├── package
    │   ├── __init__.py
    │   ├── copytemplate.py
    ├── Pipfile
    ├── README.md
    └── setup.py



    What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py and how to reference the files inside the module.



    I tried to use



    # setup.py
    setup(...
    package_data=
    "": ["template/*"]


    # reference attempt
    package_name = __name__.split('.')[0]
    print(pkg_resources.resource_listdir(package_name, ''))


    But when ever I try to reference I get a traceback for a TypeError so I don't find how to make this work.



    any ideas?










    share|improve this question




























      0












      0








      0








      I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this



      # copy_template.py
      def copy_template(destiny):
      # Find from static resources
      # and Copy the whole template dir
      copytree(resource, destiny)



      And I have a file structure like this



      # The assets dir and template dir actually have content, and I would like to 
      # reference them in the package for several reasons.
      .
      ├── assets
      │ ├── resource0
      │ ├── resource1
      │ └── resource2
      ├── template
      │   ├── data
      │   ├── img
      │   └── assets
      ├── package
      │   ├── __init__.py
      │   ├── copytemplate.py
      ├── Pipfile
      ├── README.md
      └── setup.py



      What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py and how to reference the files inside the module.



      I tried to use



      # setup.py
      setup(...
      package_data=
      "": ["template/*"]


      # reference attempt
      package_name = __name__.split('.')[0]
      print(pkg_resources.resource_listdir(package_name, ''))


      But when ever I try to reference I get a traceback for a TypeError so I don't find how to make this work.



      any ideas?










      share|improve this question
















      I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this



      # copy_template.py
      def copy_template(destiny):
      # Find from static resources
      # and Copy the whole template dir
      copytree(resource, destiny)



      And I have a file structure like this



      # The assets dir and template dir actually have content, and I would like to 
      # reference them in the package for several reasons.
      .
      ├── assets
      │ ├── resource0
      │ ├── resource1
      │ └── resource2
      ├── template
      │   ├── data
      │   ├── img
      │   └── assets
      ├── package
      │   ├── __init__.py
      │   ├── copytemplate.py
      ├── Pipfile
      ├── README.md
      └── setup.py



      What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py and how to reference the files inside the module.



      I tried to use



      # setup.py
      setup(...
      package_data=
      "": ["template/*"]


      # reference attempt
      package_name = __name__.split('.')[0]
      print(pkg_resources.resource_listdir(package_name, ''))


      But when ever I try to reference I get a traceback for a TypeError so I don't find how to make this work.



      any ideas?







      setup.py python-packaging pkg-resources






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 20:54







      ekiim

















      asked Mar 28 at 20:46









      ekiimekiim

      3314 silver badges12 bronze badges




      3314 silver badges12 bronze badges

























          0






          active

          oldest

          votes













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406593%2fpython-setup-py-and-pkg-resources-refrencing-package-data%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406593%2fpython-setup-py-and-pkg-resources-refrencing-package-data%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현