hello friends , i just need to test the Cx_freeze , i have in a folder /home/user/Bureau/testexe/ two files : Hello.py , its code is :

#!/usr/bin/python
# -*- coding: utf-8 -*- 
myfile = open('testexe.text','a')
print >> myfile, "Hello" 
myfile.close()

and a second file : makeexe.py which contain :

#makeexe.py 
#!/usr/bin/python
# -*- coding: utf-8 -*- 
from cx_Freeze import setup, Executable 
  
setup( 
    name = "MyTk_application", 
    version = "0.1", 
    description = "An Tkinter script", 
    executables = [Executable("Hello.py")] 
    )

when I run makeexe.py it print in the terminal the next error :

from: can't read /var/mail/cx_Freeze
./makeexe.py: line 6: Erreur de syntaxe près du symbole inattendu « newline »
./makeexe.py: line 6: `setup( '

I just need to know from where this error come from , thank you very much .

It is important to use command argument 'build'
Run the build process by running the command:
python makeexe.py build

Hello vegaseat , thank you for answering me , i tried many times and it could work for the example i give : hello.py , but it didn't worke for my application ( use Tkinter , psycopg2 ... ) . So i'm doing tests on a file : "Formulairetest.py" , I removed all functions and psycopg2 and its worked , so maybe the problem is with "import psycopg2" ... i'm still testing , i tell you the results , thank you very much .

Hi Vagaseat , i understand now that the problem come from the module psycopg2 ... can you explain to me please .

@Ismatus3

from cx_Freeze import setup, Executable

exe = Executable(
    script="Hello.py",
    )
 
setup(
    executables = [exe]
    )

What about

Hello telmo , i did stop using cx_freeze , i'm trying Pyinstaller .

@Ismatus3 Pyinstaller isn't ported to Python 3 yet, so I must use cx_Freeze.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.