Python Forum

Full Version: Converting to exe problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi, If someone know what this problem is, any help would be appreciated, i've tried pyw files, py files, one file, one directory, with /. for multiple files, the finish project is working only with some functions, for example, any from subprocess import call isn't working, i also have pictures display in loop, not working(also from subprocess import - from the main py file). I will display the errors that appear when converting. Angry
Also an error not appearing here, but on html page when converting Django root directory not found, but it is installed, and lots and lots of libs not found.

PS C:\Users\Nelson\Desktop\testing> auto-py-to-exe --noconsole
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 36, in walk_packages
File "<string>", line 20, in walk_packages
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\conf\urls\__init__.py", line 1, in <module>
from django.urls import include, re_path
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\urls\__init__.py", line 1, in <module>
from .base import (
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\urls\base.py", line 8, in <module>
from .exceptions import NoReverseMatch, Resolver404
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\urls\exceptions.py", line 1, in <module>
from django.http import Http404
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\http\__init__.py", line 5, in <module>
from django.http.response import (
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\http\response.py", line 15, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\core\serializers\base.py", line 7, in <module>
from django.db import models
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\db\models\__init__.py", line 3, in <module>
from django.db.models.aggregates import * # NOQA
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\db\models\aggregates.py", line 5, in <module>
from django.db.models.expressions import Case, Func, Star, When
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\db\models\expressions.py", line 8, in <module>
from django.db.models import fields
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\db\models\fields\__init__.py", line 11, in <module>
from django import forms
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\forms\__init__.py", line 6, in <module>
from django.forms.boundfield import * # NOQA
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\forms\boundfield.py", line 4, in <module>
from django.forms.widgets import Textarea, TextInput
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\forms\widgets.py", line 26, in <module>
from .renderers import get_default_renderer
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\forms\renderers.py", line 11, in <module>
from django.template.backends.jinja2 import Jinja2
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\django\template\backends\jinja2.py", line 1, in <module>
import jinja2
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\jinja2\__init__.py", line 82, in <module>
_patch_async()
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\jinja2\__init__.py", line 78, in _patch_async
from jinja2.asyncsupport import patch_all
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\jinja2\asyncsupport.py", line 13, in <module>
import asyncio
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "c:\users\nelson\appdata\local\programs\python\python37-32\lib\site-packages\asyncio\base_events.py", line 296
future = tasks.async(future, loop=self)
^
SyntaxError: invalid syntax

Please, help me, this project i'm doing, is very important to me
Let me get this straight, you are trying to convert a .py to .exe
(Apr-18-2019, 11:30 PM)SheeppOSU Wrote: [ -> ]Let me get this straight, you are trying to convert a .py to .exe
yes, totally normal, the problem is something is messed up, that gives me the main file py in exe, but some functions aren't working
Alright I got you... or rather this guy does - https://www.youtube.com/watch?v=OZSZHmWSOeM&t=108s
Exclamation
(Apr-19-2019, 12:12 AM)SheeppOSU Wrote: [ -> ]Alright I got you... or rather this guy does - https://www.youtube.com/watch?v=OZSZHmWSOeM&t=108s

Arrow I know that man, i tried so many stuff, even reinstall python. I have on the program a slide show of pictures, lots of subprocess imports; time: pygame; and a music file(mp3), i'm not sure but i think is something related with pygame, but i can't remove it or the program will not work.

1. I tried convert with all python files in pyw (final output - only the main in exe working, any subprocess, slide show of pictures, music, not working)
2. I tried convert with all python files in py (final output - varies based on the way i do it when cconverting, if i do one way, the main program will be without (c:/users/name/desktop/name_file.exe on the foreground - like a command prompt) behind the normal exe file which is in the front, everthing else, will popup the cmd behind any subprocess i open), if i do the other way, i get the main program with the cmd behind and all of the subprocess won't popup anything.

So why is this happening, can't i put all of them without the black window behind? If this window is really necessary for the program to work, what command can i issue, so the window won't display, rather stays minimized and when user closes the program it will close the window?
Not sure if this will help, but I use pythonw.exe it works without displaying the windows.
When you say black window are you taking about the cmd/command prompt/console

If your getting errors from that it probably means there is something wrong in your code, probably something to do about location of pictures and not being able to find imports all that stuff. If you are using pyinstaller from the link above, there is an option for window based meaning the console/cmd won't appear. If the problem is w/ being able to find pictures/songs I would suggest something like this -
import os
from pathlib import Path #may have to use pip to install

d = Path(__file__).parent
picture = os.path.join(d, 'Folder for stuff', 'picture.png') #The "Folder for Stuff" would be in the same directory as the .exe
(Apr-20-2019, 12:51 PM)gehrenfeld Wrote: [ -> ]Not sure if this will help, but I use pythonw.exe it works without displaying the windows.

Tried, not working
You said that you use photos in this code correct

Could you give me a line in your code where you import a picture
(Apr-20-2019, 08:11 PM)SheeppOSU Wrote: [ -> ]When you say black window are you taking about the cmd/command prompt/console

If your getting errors from that it probably means there is something wrong in your code, probably something to do about location of pictures and not being able to find imports all that stuff. If you are using pyinstaller from the link above, there is an option for window based meaning the console/cmd won't appear. If the problem is w/ being able to find pictures/songs I would suggest something like this -
import os
from pathlib import Path #may have to use pip to install

d = Path(__file__).parent
picture = os.path.join(d, 'Folder for stuff', 'picture.png') #The "Folder for Stuff" would be in the same directory as the .exe

I will try that later on. I have created a tkinter warning to tell people to not close the cmd, otherwise the program will close and i have already made a setup of exe for anyone to install in there computers if they won't to see ig they like it and want they wanna see on the program. So, this post i can end it here. Many thanks all for the replies.

(Apr-20-2019, 11:20 PM)SheeppOSU Wrote: [ -> ]You said that you use photos in this code correct

Could you give me a line in your code where you import a picture

I have send you a pm
Pages: 1 2