when i convert pygame file to .exe file pyinstaller says can't open script - pygame

I made a simple flappy bird game. I wanna convert it to .exe file, and I did it with pyinstaller but when I try to open the .exe file in the dist folder it says can't run script
I then copied my assets folder and pasted it into the dist folder, then too its not working.
How do I make it work?

If you are converting a .pyw file, then PyInstaller will only show the game window when you will run it.
If you want to convert a .py file, it will also show the Command Prompt.
If you are getting an error in the form of a message box, that means that an error has stopped your code. Because you converted a .pyw file, the error will not be shown in the Command Prompt. A message box will appear instead.
To see what was the error in a more explicit way, you can:
1. Convert your file from .py to .exe to see the error in the Command Prompt instead of in a message box.
Then, you can record your screen and see what was the error.
2. Show the message box by yourself
Before converting your file, edit it like that:
from tkinter.messagebox import showerror
try:
# your ENTIRE code here
except Exception as error:
showerror('Error detected', error)
This way the error will be shown in a Tkinter message box like that:
Common errors:
You forgot to put an image in the .exe directory
pygame.font.SysFont does not work: use pygame.font.Font instead and use a .ttf file (more information here)
exit() is not recognised, use sys.exit() instead (and import sys of course)

Related

How to save the output of Eclipse in a different file in every run for sap abap

i have a run a program and i got some output on the console as
{"CUSTOMER_ID":"0000010001","CUSTOMER":"IDADMIN","ADDRESS":"Chennai"}
{"CUSTOMER_ID":"0000010004","CUSTOMER":"IDADMIN","ADDRESS":"Bangalore"}
now i need to save the output of Eclipse in a different file
when i checked in google for this i found few steps to achieve it.
Write a program as usual in eclipse.
While on the program screen, click on Run -> Run Configurations…
Navigate to “Common” tab
Check “File:” and “Append” box and enter the file path and apply
Run the test as usual, check the file at specified path…
the file is creating in the path but instead of the output in console some text has been saving in it like the process of transfering.

How to change file type of a file in PhpStorm?

I have a TypeScript project I manage with PhpStorm. All the *.ts files are properly recognized as TypeScript files and in my file types setting I have the *.ts file map TypeScript.
All the files? No, one file stubbornly won't be treated as a TypeScript file but is shown as plain text. I have no idea how to mark this one as a TypeScript file.
All the *.ts file have the proper ts icon next to them. This one hasn't.
When I open the rogue .ts file, PhpStorm tells me that there are plugins for that file type, yet if I try to follow that route, all it leads me to is for PhpStorm to try to install the TypoScript plugin for which I have no need at all.
I tried:
renaming file from *.ts to *.txt and back to *.ts;
deleting it within PhpStorm and checking it out via git again;
right clicking the file in the Project pane hoping a setting is there in order to mark it as a TypeScript file, yet no such things seems to exist;
invalidating the cache and restart.
It remains a simple text file without syntax highlighting and other TypeScript code importing this file have the error that the references cannot be found within PhpStorm.
It's a valid TypeScript project though, tsc on command line runs fine.
How can I tell PhpStorm to treat this rogue .ts file as a TypeScript file as well?
Go to Preferences > File Types > Text Files and see if the name of the file is listed there. If it is, delete it from that list.

Loading icon from kit using twapi

I have a tcl script named main.tcl in a folder called App. One of the lines in the script uses a command from the twapi module (that line is actually in a proc and I'm trying to minimize the app to system tray when a user closes the app through the 'X' window button):
package require twapi
# ... code here
set hand [twapi::load_icon_from_file tclkit.ico]
# ... code here
The file tclkit.ico is in the same directory as the script (i.e. in the folder App).
When main.tcl is run through wish, the script works without any issues, but after wrapping it into an executable through command line,
> tclkit sdx.kit wrap App -runtime tclsh863.exe
the executable raises an error, notably that the icon file could not be found:
The system cannot find the file specified.
The system cannot find the file specified.
while executing
"LoadImage $hmod $path $type $opts(width) $opts(height) $flags"
(procedure "twapi::_load_image" line 18)
invoked from within
"twapi::load_icon_from_file tclkit.ico"
(procedure "min_to_tray" line 2)
invoked from within
"min_to_tray"
(command for "WM_DELETE_WINDOW" window manager protocol)
The current workaround right now is to have a copy of the tclkit.ico file in the same directory as the .exe but I want to avoid that as much as possible and only have the standalone .exe file. I tried using the full path with:
set hand [twapi::load_icon_from_file [file join [pwd] App.exe tclkit.ico]]
which normally works when I want to read a file (.txt, .png files, etc.) within the .exe, without success.
So basically, is there a way to enable the .exe to load the .ico file from within itself or another workaround that will not require some dependence on a file outside the .exe app?
The core issue is that the relevant Windows API actually takes a filename, and not something that it's more easy to wrap loading-from-archive around (such as a buffer). This means that you have to copy the file out of the archive somewhere and then pass that name to the system call. This is in fact what Tcl does internally for load when it's pulling the DLL from a source that isn't directly visible to the OS; it doesn't do it automatically for TWAPI though, as that library takes the philosophical position of being just a thin wrapper and letting the caller handle the consequences (which does mean you can easily do more tricks, provided you're inventive).
I suggest copying the file to a temporary file somewhere (i.e., the standard location for these things; Tcl 8.6 has file tempfile to help with this sort of trick) and then passing the full filename into the TWAPI call. I think everywhere in the Windows API that you could pass a simple filename in, you can also pass a full filename. (That's actually very convenient…)

IrfanView generate HTML file from Thumbnails in cmd

I try generate from IrfanView cmd interface HTML page from directory with Thumbnails, but I can't find any parameter or options, how I can do it.
I can generate Thumbnails via:
"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Test\FullScreens\*.jpg" /resize=(100,100) /aspectratio /resample /convert="C:\Test\*.png
I can't find this in cmd:
It is possible to realize this?
Thank you, Regards,
  Peter
The text file i_options.txt in program files folder of IrfanView contains all options which can be used on command line. There is no option to create an HTML file. This must be done via GUI using the captured dialog.
But after creating the thumbnails for the images, it would be of course possible to create with a batch file also the HTML file using the commands echo, for, if and set with output created by several echo command lines redirected to the HTML file to create. Executing in a command prompt window help echo, help for, ... displays help on those internal commands of command interpreter cmd.
However, it would be a lot of work to create a batch file with all the parameters of the dialog. And it would make the batch file slower to really support all those parameters. A tailor-made batch file for creating the HTML file exactly like you want them would be much easier to code.
I suggest to try by yourself coding the batch file to create the HTML file. Create a new question with a link to this question, if you have somewhere a problem which you can't solve by yourself. Post in this question the batch code you have so far and the content of the HTML file created by IrfanView which should be instead created by the batch file.

Error trying to parse settings: No data in ~/.config/sublime-text-2/Packages/User/CTags.sublime-settings:1:1

I am using ubantu and trying to configure ctags on sublime text 2 for rails.
I am getting the above error message on opening my sublime text.
On re building ctags its completing within a flash without generating a .ctag file in the specified location.
My guess is that is an empty file right now. Open the file (possibly through another editor) and insert {}. The settings files are JSON objects. That just looks like it's failing the JSON parse.
You could run cat ~/.config/sublime-text-2/Packages/User/CTags.sublime-settings to see if there is anything in the file. If there is not you could freely delete it.
Though this error could be caused by a plugin that requires some configuration looking for its preferences file and failing.