Showing posts with label py2exe. Show all posts
Showing posts with label py2exe. Show all posts

Thursday, April 21, 2016

py2exe suddenly no longer working. No module named _view

Leave a Comment

Running an exe compiled in py2exe is now giving me this error:

C:\Users\digiholic\git\universalSmashSystem\main.exe\zipextimporter.py:82: RuntimeWarning: import display: No module named _view (ImportError: No module named _view) C:\Users\digiholic\git\universalSmashSystem\main.exe\zipextimporter.py:82: RuntimeWarning: import draw: No module named _view (ImportError: No module named _view) C:\Users\digiholic\git\universalSmashSystem\main.exe\zipextimporter.py:82: RuntimeWarning: import image: No module named _view (ImportError: No module named _view) C:\Users\digiholic\git\universalSmashSystem\main.exe\zipextimporter.py:82: RuntimeWarning: import pixelcopy: No module named _view (ImportError: No module named _view) C:\Users\digiholic\git\universalSmashSystem\main.exe\zipextimporter.py:82: RuntimeWarning: import transform: No module named _view (ImportError: No module named _view) 

I did not modify my py2exe file since the last working build, nor have I made any significant changes to my Python installation. I have modified code, which must be causing this issue, but the error message is giving me no information on how to fix it. What could cause this issue?

I have put import pygame._view at the top of my main.py script and it is not helping. I do not reference any system fonts, all fonts used in my code are .ttf files in my package.

EDIT: Searched more. import re is not working either.

2 Answers

Answers 1

The solution is to add import pygame._view to the top of your main source file. Any of the packagers should work after that.

Try to do so. Some similar question was already asked in the past.

Please check also Pygame to exe display module error [duplicate] and Opening an EXE of my Pygame program gives me import errors

IF you look at the second answer the problem was in the "font" usage. Maybe you did something similar :-) Try it out and let us know.

Unfortunately I am not personally using pygame module :-( but I guess for the defined _view you have to use the import as you did correctly :-)

Hope this solve your query :-) Have a nice day.

Answers 2

This is looking like a PYTHONPATH issue. You need to verify that all of the locations where these modules are located are either in the development directory itself or in your search path for Python.

You can do a:

print sys.path 

to see what is in your search path and validate those modules are in it. It is possible something changed it. Once you verify that, you can add the missing paths using PYTHONPATH.

Read More

Thursday, March 31, 2016

How to bundle httrack into a python 3 executable

Leave a Comment

There is a great website copier that I would like to bundle in my executable, created with python 3 and py2exe.
On the HTTrack official website in the FAQ section they say that there is a DLL/library version available.
But I don't know where to start, or even how to use the DLL once it would be bundled in the executable.
So how can I bundle httrack into a python 3 executable, and use its features to start copying websites?
Edit:
I found httrack-py 0.6.1 but it only supports python 2 and uses an old version of httrack, so I can't use this for my executable.

1 Answers

Answers 1

As I see it you have 2 options:

  1. You could try to convert httrack-py to python 3 following these instructions, but it's usually never a good idea to work with outdated and unmaintained 3rd party library.

  2. Since the official HTTrack provides you with DLL, you can use the library directly from python 3 code. A stackoverflow question How can I use a DLL file from Python? gives an excellent answer on how to do just that.

    The py2exe merely creates a windows installer which will take care of the details of installing python interpreter and your python code to the target system so that end user does not need to deal with anything else than just one .exe . This means you have to include 3rd party DLL's in the configuration - I would guess 3rd party DLL's to go into "data_files" (not tested this myself though).

Read More