Pyinstaller adding data files











up vote
4
down vote

favorite
2












I'm struggling with pyinstaller, whenever I build this specific script with a kivy GUI and run the .exe after the build I get a fatal error that it couldn't perform the scrip. I ran it through the cmd and it give me the error: IOError: [Errno 2] No such file or directory: 'main.kv'



I've tried adding the .kv file as well as a mdb and dsn file (using pypyodbc in script) using --add-data when starting the build but in doing so I get an error: unrecognized arguments: --add-data'main.kv'(The rest of the specified files for --add-data follows)
Are there any solutions for this or maybe alternative methods?










share|improve this question




























    up vote
    4
    down vote

    favorite
    2












    I'm struggling with pyinstaller, whenever I build this specific script with a kivy GUI and run the .exe after the build I get a fatal error that it couldn't perform the scrip. I ran it through the cmd and it give me the error: IOError: [Errno 2] No such file or directory: 'main.kv'



    I've tried adding the .kv file as well as a mdb and dsn file (using pypyodbc in script) using --add-data when starting the build but in doing so I get an error: unrecognized arguments: --add-data'main.kv'(The rest of the specified files for --add-data follows)
    Are there any solutions for this or maybe alternative methods?










    share|improve this question


























      up vote
      4
      down vote

      favorite
      2









      up vote
      4
      down vote

      favorite
      2






      2





      I'm struggling with pyinstaller, whenever I build this specific script with a kivy GUI and run the .exe after the build I get a fatal error that it couldn't perform the scrip. I ran it through the cmd and it give me the error: IOError: [Errno 2] No such file or directory: 'main.kv'



      I've tried adding the .kv file as well as a mdb and dsn file (using pypyodbc in script) using --add-data when starting the build but in doing so I get an error: unrecognized arguments: --add-data'main.kv'(The rest of the specified files for --add-data follows)
      Are there any solutions for this or maybe alternative methods?










      share|improve this question















      I'm struggling with pyinstaller, whenever I build this specific script with a kivy GUI and run the .exe after the build I get a fatal error that it couldn't perform the scrip. I ran it through the cmd and it give me the error: IOError: [Errno 2] No such file or directory: 'main.kv'



      I've tried adding the .kv file as well as a mdb and dsn file (using pypyodbc in script) using --add-data when starting the build but in doing so I get an error: unrecognized arguments: --add-data'main.kv'(The rest of the specified files for --add-data follows)
      Are there any solutions for this or maybe alternative methods?







      pyinstaller






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 28 '17 at 21:57









      Stéphane

      4761624




      4761624










      asked Jan 26 '17 at 9:49









      staos2

      2515




      2515
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          11
          down vote













          If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try



          pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py





          share|improve this answer



















          • 2




            Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
            – schlimmchen
            Oct 9 '17 at 13:14










          • with respect to the output dist/ folder, where did main.kv end up?
            – bw4sz
            Apr 11 at 16:13










          • man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
            – Joran Beasley
            May 17 at 0:08


















          up vote
          1
          down vote













          The solution is to run: pyi-makespec yourscript.py
          Then edit the yourscript.spec script and add the files under datas in a= Analysis.



          datas=[ ( '/pathToYourFile/main.kv', '.' )]


          then run pyinstaller yourscript.spec
          should be good after that.






          share|improve this answer

















          • 1




            It shows too many values to unpack error.
            – Harshit Agrawal
            Apr 22 at 19:44












          • @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
            – Pavel M.
            Oct 31 at 0:40










          • @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
            – Harshit Agrawal
            Nov 3 at 11:18











          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/3.0/"u003ecc by-sa 3.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%2f41870727%2fpyinstaller-adding-data-files%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          11
          down vote













          If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try



          pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py





          share|improve this answer



















          • 2




            Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
            – schlimmchen
            Oct 9 '17 at 13:14










          • with respect to the output dist/ folder, where did main.kv end up?
            – bw4sz
            Apr 11 at 16:13










          • man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
            – Joran Beasley
            May 17 at 0:08















          up vote
          11
          down vote













          If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try



          pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py





          share|improve this answer



















          • 2




            Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
            – schlimmchen
            Oct 9 '17 at 13:14










          • with respect to the output dist/ folder, where did main.kv end up?
            – bw4sz
            Apr 11 at 16:13










          • man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
            – Joran Beasley
            May 17 at 0:08













          up vote
          11
          down vote










          up vote
          11
          down vote









          If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try



          pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py





          share|improve this answer














          If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try



          pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 9 '17 at 14:44









          schlimmchen

          13416




          13416










          answered May 17 '17 at 2:34









          Anson Chan

          11115




          11115








          • 2




            Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
            – schlimmchen
            Oct 9 '17 at 13:14










          • with respect to the output dist/ folder, where did main.kv end up?
            – bw4sz
            Apr 11 at 16:13










          • man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
            – Joran Beasley
            May 17 at 0:08














          • 2




            Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
            – schlimmchen
            Oct 9 '17 at 13:14










          • with respect to the output dist/ folder, where did main.kv end up?
            – bw4sz
            Apr 11 at 16:13










          • man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
            – Joran Beasley
            May 17 at 0:08








          2




          2




          Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
          – schlimmchen
          Oct 9 '17 at 13:14




          Whether to use a semicolon or colon as the separator depends on os.pathsep, i.e., on most *nix systems this is a colon and on Windows this should be a semicolon.
          – schlimmchen
          Oct 9 '17 at 13:14












          with respect to the output dist/ folder, where did main.kv end up?
          – bw4sz
          Apr 11 at 16:13




          with respect to the output dist/ folder, where did main.kv end up?
          – bw4sz
          Apr 11 at 16:13












          man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
          – Joran Beasley
          May 17 at 0:08




          man pyinstaller docs could make that more clear ... all the examples i found used : ... usually i just do it in the spec file but i really didnt want a spec file for this project
          – Joran Beasley
          May 17 at 0:08












          up vote
          1
          down vote













          The solution is to run: pyi-makespec yourscript.py
          Then edit the yourscript.spec script and add the files under datas in a= Analysis.



          datas=[ ( '/pathToYourFile/main.kv', '.' )]


          then run pyinstaller yourscript.spec
          should be good after that.






          share|improve this answer

















          • 1




            It shows too many values to unpack error.
            – Harshit Agrawal
            Apr 22 at 19:44












          • @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
            – Pavel M.
            Oct 31 at 0:40










          • @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
            – Harshit Agrawal
            Nov 3 at 11:18















          up vote
          1
          down vote













          The solution is to run: pyi-makespec yourscript.py
          Then edit the yourscript.spec script and add the files under datas in a= Analysis.



          datas=[ ( '/pathToYourFile/main.kv', '.' )]


          then run pyinstaller yourscript.spec
          should be good after that.






          share|improve this answer

















          • 1




            It shows too many values to unpack error.
            – Harshit Agrawal
            Apr 22 at 19:44












          • @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
            – Pavel M.
            Oct 31 at 0:40










          • @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
            – Harshit Agrawal
            Nov 3 at 11:18













          up vote
          1
          down vote










          up vote
          1
          down vote









          The solution is to run: pyi-makespec yourscript.py
          Then edit the yourscript.spec script and add the files under datas in a= Analysis.



          datas=[ ( '/pathToYourFile/main.kv', '.' )]


          then run pyinstaller yourscript.spec
          should be good after that.






          share|improve this answer












          The solution is to run: pyi-makespec yourscript.py
          Then edit the yourscript.spec script and add the files under datas in a= Analysis.



          datas=[ ( '/pathToYourFile/main.kv', '.' )]


          then run pyinstaller yourscript.spec
          should be good after that.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 18 '17 at 20:16









          kaminsknator

          460316




          460316








          • 1




            It shows too many values to unpack error.
            – Harshit Agrawal
            Apr 22 at 19:44












          • @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
            – Pavel M.
            Oct 31 at 0:40










          • @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
            – Harshit Agrawal
            Nov 3 at 11:18














          • 1




            It shows too many values to unpack error.
            – Harshit Agrawal
            Apr 22 at 19:44












          • @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
            – Pavel M.
            Oct 31 at 0:40










          • @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
            – Harshit Agrawal
            Nov 3 at 11:18








          1




          1




          It shows too many values to unpack error.
          – Harshit Agrawal
          Apr 22 at 19:44






          It shows too many values to unpack error.
          – Harshit Agrawal
          Apr 22 at 19:44














          @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
          – Pavel M.
          Oct 31 at 0:40




          @HarshitAgrawal Add comma then: datas=[ ( '/pathToYourFile/main.kv', '.' )],
          – Pavel M.
          Oct 31 at 0:40












          @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
          – Harshit Agrawal
          Nov 3 at 11:18




          @pmus I did tried with using commas too but didnt worked and showed the same error when I run the .exe file "too many values to unpack" error.
          – Harshit Agrawal
          Nov 3 at 11:18


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f41870727%2fpyinstaller-adding-data-files%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







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini