Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I encountered <a href="https://stackoverflow.com/questions/9313152/py2exe-importerror">similar probelm with py2exe</a> and the only solution I can find ,is to use another tool to convert python to exe - pyinstaller </p> <p>Its very easy tool to use and more important , it works! </p> <p><strong>UPDATE</strong></p> <p>As I understood from your comments below , running your script from command line is not working also , due to import error (<strong>My recommendation is to first check your code from command line ,and than try to convert it to EXE</strong>) </p> <p>It looks like PYTHONPATH problem.<br> PYTHONPATH is list of paths (similar of Windows PATH) that python programs use to find import modules. If your script run from your IDE , that means the PYTHONPATH is set correctly in the IDE ,so all imported modules are found.</p> <p>In order to set PYTHONPATH you can use :</p> <pre><code>import sys| sys.path.append(pathname) </code></pre> <p>or use the following code that add the all folders under <strong>path</strong> parameter to PYTHONPATH:</p> <pre><code>import os import sys def add_tree_to_pythonpath(path): """ Function: add_tree_to_pythonpath Description: Go over each directory in path and add it to PYTHONPATH Parameters: path - Parent path to start from Return: None """ # Go over each directory and file in path for f in os.listdir(path): if f == ".bzr" or f.lower() == "dll": # Ignore bzr and dll directories (optional to NOT include specific folders) continue pathname = os.path.join(path, f) if os.path.isdir(pathname) == True: # Add path to PYTHONPATH sys.path.append(pathname) # It is a directory, recurse into it add_tree_to_pythonpath(pathname) else: continue def startup(): """ Function: startup Description: Startup actions needed before call to main function Parameters: None Return: None """ parent_path = os.path.normpath(os.path.join(os.getcwd(), "..")) parent_path = os.path.normpath(os.path.join(parent_path, "..")) # Go over each directory in parent_path and add it to PYTHONPATH add_tree_to_pythonpath(parent_path) # Start the program main() startup() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload