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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:26:30+00:00 2026-06-01T23:26:30+00:00

I am trying to create an exe file from my program written in Python

  • 0

I am trying to create an exe file from my program written in Python 2.7 (using GTK+ layouts). I have consulted this guide: http://www.py2exe.org/index.cgi/Py2exeAndPyGTK and tried to set up my files accordingly. I succesfully make an .exe file, but when trying to run it, i get this error:

Traceback (most recent call last):
  File "cipherka.py", line 183, in <module>
  File "cipherka.py", line 18, in __init__
GError: Nelze otevřít soubor "C:\Repa\cipherka\dist\library.zip\gui.xml": No such file or directory

While I cannot find the gui.xml file in the library.zip archive, it is available on the same level as the main .exe (cipherka.exe) file. If i copy it into the .zip file on my own, it doesn’t solve the problem.

Here is my setup.py file:

from distutils.core import setup
import py2exe
import glob

setup(
    name="cipherka",
    windows = [
                  {
                      'script': 'cipherka.py',
                  }
              ],

    options = {
                  'py2exe': {
                      'packages':'encodings',
                      'includes': 'cairo, pango, pangocairo, atk, gobject, gio',
                  }
              },
    data_files=['gui.xml',
                'README',
                ("modules", glob.glob("modules/*.*")),
                ("media", glob.glob("media/*.png"))
    ]
)

Any help will be wildly appreciated! And I can give you any necessary info when needed. Thx

UPDATE:

Allright, I implemented the change. However, it does weird things. When i use:

path = os.path.dirname(__file__).replace('\\library.zip','')

it works when ran from the .py file, but fails when compiled with this error:

Traceback (most recent call last):
  File "cipherka.py", line 217, in <module>
  File "cipherka.py", line 18, in __init__
NameError: global name '__file__' is not defined

When i use

path = os.path.dirname('gui.xml').replace('\\library.zip','')

instead – the program stops running from python and the compiled version gives me the following:

C:\Repa\cipherka\dist\cipherka.exe:188: GtkWarning: gtk_tree_path_append_index: assertion `index >= 0' failed
C:\Repa\cipherka\dist\cipherka.exe:188: GtkWarning: gtk_tree_model_get_iter: assertion `path->depth > 0' failed
Traceback (most recent call last):
  File "cipherka.py", line 217, in <module>
  File "cipherka.py", line 55, in __init__
  File "cipherka.py", line 188, in changed_cb
IndexError: could not find tree path

Any ideas?

  • 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-06-01T23:26:31+00:00Added an answer on June 1, 2026 at 11:26 pm

    "gui.xml" is in "C:\Repa\cipherka\dist\", not "C:\Repa\cipherka\dist\library.zip" as your code supposes.

    This should work whether your program is compiled or not.

    path = os.path.dirname(__file__).replace('\\library.zip','')
    xml_file = open(os.path.join(path, 'gui.xml'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an exe file using NSIS script, in my script
I am trying to create a batch file that removes tel: from a number
This is part of a python program under windows environment. I am trying to
I am trying to create a program that the user must run the .exe
I am trying to create a simple COM server using Python 2.7 on 64
I have a WSDL file and I am trying to create a web service
I have the following error when trying to import .sql file into MYSQL from
I'm using process.Start to run Convert.exe. This program's purpose is to convert all files
I’m trying to create a simple Win32 DLL. As interface between DLL and EXE
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

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.