Is it possible, to re-convert an .exe to python3-Script again? - python-3.x

I'm writing a program with a Login-Window at the beginning.
Since this program is only for my personal use, there is only
one password set, which is implemented in the code. I built an .exe
via pyinstaller and its not possible to read out information out of the
.exe-file. Now i would like to know, if it's possible to re-convert
the .exe into the python3-script to read out the password, or if there is any other way to get information about the script using the .exe-file.

I have not tried yet, but I found in some blog that the following command works.
python pyinstxtractor.py file_to_decompile

Related

Golem Task respons back with runtime error 2, can't determine the cause

Repo for all code I've been using is updated here . When I run the requestor script it exits with a runtime error 2 (File not found). I am not sure how to further debug this or fix it. So far I've converted my code over to a python slim docker image to better mirror the example. It also works for me when I spin up a docker image that typing and running "/golem/work/imageclassifier.py --trainmodel" works from root. I switched all my code to use absolute paths. I also did make sure the shebang (#!) uses linux end of file characters rather than windows before which was giving me errors. Fixed a bug where my script returns error code 2 when called with no args to now pass.
clf.fit(trainDataGlobal, trainLabelsGlobal)
pkl_file = "classifier.pkl"
with open(pkl_file, 'wb') as file:
pickle.dump(clf, file)
is the only piece I could think of that causes the issue, but as far as I can tell this is the proper way to pickle something in python. Requestor script is also heavily based on the simple service example and I tried to mirror my design to that. I just need help in getting more information while debugging, or guidance on how to move forward from here

Can you read the length of an mp3 file in python 3 on windows 10?

I am currently creating a music player in python 3.3 and I have a way of opening the mp3/wav files, namely through using through 'os.startfile()', but, this way of running the files means that if I run more than one, the second cancels the first, and the third cancels the second, and so on and so forth, so I only end up running the last file. So, basically, I would like a way of reading the mp3 file length so that I can use 'time.sleep(SongLength)' between the start of each file.
Thanks in advance.
EDIT:
I forgot to mention, but I would prefer to do this using only pre-installed libraries, as i am hoping to publish this online as a part of a (much) larger program
i've managed to do this Using an external module, as after ages of trying to do it without any, i gave up and used tinytag, as it is easy to install and use.
Nothing you can do without external libraries, as far as I know. Try using pymad.
Use it like this:
import mad
SongFile = mad.MadFile("something.mp3")
SongLength = SongFile.total_time()

How do I simulate keyboard events in Chromedriver/Selenium for Node.js?

I'm trying to automate uploading an image file to a server to which I don't have a better form of access (FTP, etc.). I'm using Node.js with Selenium and Chromedriver, and everything is going well until I need to simulate special keys. I've researched a bit, and have found nothing so far. Mac specific answers are ok for this.
I tried this from another answer somewhere, but it's not working for me:
driver.findElement(webdriver.By.name(uploadName))
.click()
.sendKeys(Keys.COMMAND + Keys.SHIFT + 'g')
.sendKeys(imgPath)
.sendKeys(Keys.RETURN);
It fails out because Keys is undefined, but I haven't run across any other ways to get at the commands.
After further research, it seems that this is the wrong way to do this. Selenium and Chromedriver don't really support OS level interaction, but there is an easier way.
driver.findElement(webdriver.By.name(uploadName)).sendKeys(imgPath);
This will target uploadName and then give it the file path passed into sendKeys. This bypasses the messy OS file dialogs.

Can I alter Python source code while executing?

What I mean by this is:
I have a program. The end user is currently using it. I submit a new piece of source code and expect it to run as if it were always there?
I can't find an answer that specifically answers the point.
I'd like to be able to say, "extend" or add new features (rather than fix something that's already there on the fly) to the program without requiring a termination of the program (eg. Restart or exit).
Yes, you can definitely do that in python.
Although, it opens a security hole, so be very careful.
You can easily do this by setting up a "loader" class that can collect the source code you want it to use and then call the exec builtin function, just pass some python source code in and it will be evaluated.
Check the package
http://opensourcehacker.com/2011/11/08/sauna-reload-the-most-awesomely-named-python-package-ever/ . It allows to overcome certain raw edges of plain exec. Also it may be worth to check Dynamically reload a class definition in Python

Open Files Created with BSAVE in QuickBasic?

I have some files that were created using BSAVE in QuickBasic. I'm wondering how I can load/view these files?
I received assistance over at the FreeBasic forums. Its easy to do if you download and install the FreeBasic compiler / IDE. Here is the relevant thread:
http://www.freebasic.net/forum/viewtopic.php?t=12554&postdays=0&postorder=asc&start=0
Essentially, it loads the image using BLOAD like one normally would and then BSAVEs it as a BMP. I suppose it would be pretty easy to create an app. that did this by just prompting for source and output files...
I would try installing pcpaint (free) http://www.shdon.com/software/pcpaint
Change the extension to .PIC and try to open it. Apparently this program used bsave to save images with the extention .pic.
Hope this works!

Resources