cx_Freeze. How install service and execute script after install - python

I wrote lets scripts for customer. In order not to install python and dependent packages, I packed all to 3 exe-file using cx-freeze. First - winservice, who does most of the work. Second - settings wizard. Third - client for work with winservice. Faced to the task, need after installing the package (made using bdist_msi) register the service in system, and run the wizard. How do it?

I think if you don't have a certificate that's impossible.

Related

install a python package for w python utility offline

I don't know python but I need to install a python utility. when running it using python ./main.py I am getting a message "No module named web" I downloaded the web.py .
My question is how to install it and where to put the webpy-master directory (that was downloaded when searching for the web.py ) or the web dir under it and what exactly to do
Note that I am running in an environment without web access so I can't just do pip install
and my python version is 2.7 (this is what the utility needs)
I saw this answer
Python Packages Offline Installation
but since I don't know python and i can't download other things ( it's complicated , need to go to security department etc ) also I don't understand how to use environment.txt
please don't set it as duplicate.
I put the Web directory where the main.py is and added
import web
to the main.py and it worked ! thank you !

Error installing Python 2 packages in Azure Automation

I'm trying to install Instagram-API-python in Azure Automation to automatize data extraction from this API with a Python script.
When I try to install it uploading the .tar.gz file or by the "Import Python 2 packages from pypi" script, azure automation shows me the following message:
Orchestrator.Activities.PythonPackageExtractException: Error while
extractinig Python package: Error converting tar.gz file to wheel
file. Unexpected number of wheel files were created. at
Orchestrator.Activities.SetModuleActivity.ExecuteInternal(CodeActivityContext
context, Byte[] moduleContent, String moduleName, ModuleLanguage
moduleLanguage, Guid moduleVersionId, String modulePath) at
Orchestrator.Activities.SetModuleActivity.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
Any idea why it is showing me this message?
I am assuming that it is failing as it is not able to resolve all the dependencies , try using the Manual download option.
Azure automation doesn't resolve dependencies for python packages during the import process. There are two ways to import a package with all its dependencies. Only one of the following steps needs to be used to import the packages into your Automation Account.
Manual Download
On a Windows 64-bit machine with python2.7 and pip installed, run the following command to download a package and all its dependencies:
C:\Python27\Scripts\pip2.7.exe download -d <output dir> <package name>
Once the packages are downloaded, you can import them into your automation account.
RunBook
Import the python runbook Import Python 2 packages from pypi into Azure Automation account from the gallery into your Automation Account. Make sure the Run Settings are set to Azure and start the runbook with the parameters. The runbook requires a Run As Account for the Automation Account to work. For each parameter make sure you start it with the switch as seen in the following list and image:
s
g
a
m
The runbook allows you to specify what package to download, for example, Azure (the fourth parameter) will download all Azure modules and all its dependencies, which is about 105.
Once the runbook has completed you can check the Python 2 packages page under Shared Resources in your Automation Account to verify that they package was imported correctly.
Hope it helps.
The Manual Download worked for me.

0x80070643 error while installing Python 3.6

I'm actually using Python for an audio steganography project but I have some troubles.
I searched this error code on the forum, but I found things about SQL installations and not Python.
I'm trying to re-install Python 3.6.5 after an uninstall, because of a bug with pip.
I installed Python 2.7, Python 3.6.5, Python with VS 2017, before uninstall it because it wasn't working.
However, when I'm runing the installer as an administrator, hit "customize installation", tick everything excpet "balblalblabal (this requires VS 2015 or later)", and click on "install", it tells me that :
.
I realy need Python to work and I'm now stuck ...
If anybody here could help me, it would be nice !
Thanks all,
maleik.
PS : I have the log for you :*
The log link
I found this in the log file which you have attached. Try cleaning the registry with CC cleaner and give it a try. If it still doesn't work, try installing python with web installer Python Web Installed 3.6.5.
[3DA0:2968][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to install MSI package.
[3DA0:2968][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to execute MSI package.
[2610:03A4][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[2610:03A4][2018-12-05T20:46:18]i319: Applied execute package: core_AllUsers, result: 0x80070643, restart: None
[2610:03A4][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to execute MSI package
I installed python from Microsoft store after facing this problem and it magically got installed without any error as it may have directly been installed. I don't know but try if it eorks for you too.
You need to run the installation as a local administrator.
I had the same problem installing Python version 3.9 for the first time on my Windows 10, as this same problem happens to many users trying to install Python, the best solution I accidentally, just like #MANAN AGGARWAL discovered trying to check if I already had a version of Python installed on my computer by the DOS Command Prompt, was:
Open the DOS Command Prompt (cmd) and dictate "python": if a screen shows you a version, it's clearly not the first time you've installed Python, so if you want to upgrade you should try: https: / /www.delftstack.com/en/howto/python/how-to-update-python/ But if you've never installed any version of Python, the solution lies in updating your operating system to the latest version through Windows Update, and open the command prompt and type Python, or go directly to the Microsoft Store and search for Python followed by its latest version. It works without error.
** If by chance it does not automatically install on your PC after downloading, click "install on my devices" and select your computer name.
Why can't I install Python directly from the website file? Please note that when trying to install any software/applications from outside Microsoft's trusted locations, there are high chances of user settings interfering with the installation. When coming, for example, from the Microsoft Store, a chance of success is much greater, even without having problems related to User Permission Settings.
Another important thing to point out here is that installing a lot of software from outside Microsoft's trusted platforms can cause you to change some user permissions which can have positive effects with some software and negative effects with others, even with security your own system if you don't know what you're doing.
it's simple , Try Lower Version Like 'Python 3.6' but Download web install.
install it , then install last python version.
your python will update.
I've faced same/similar problem with installing Python 3.9.12 in a clean Windows 8.1 64-bit (VirtualBoxed test environment).
I thought the issue could have been fixed in a newer version of Python, but the freshest 3.10.10 fails with same issue.
The original log isn't available any longer, but luckily it is quoted in another answer, and the following line reveals the real problem:
Applied execute package: core_AllUsers, result: 0x80070643, restart: None
My log looks the same, and if you scroll the log up, you'll discover that core_AllUsers is a UCRT MSI-installer, which is downloaded from Python site (for 3.10.10 64-bit the link may look like https://www.python.org/ftp/python/3.10.10/amd64/ucrt.msi).
If you download it manually (Python installer is smart enough to do a cleanup even if it fails, so you won't find this MSI in a local cache) and run, it will probably crash. And if it is your case, I have a simple solution - just install update KB2999226 (Update for Universal C Runtime) for your OS, which you can download from Microsoft.
I also faced the similar issue. What the trick worked for me is I installed it for the individual user (as earlier installation was for the all users).
So earlier if one has installed it for the all users then install it for the specific user and vice versa.
I know this is not the resolution of the error faced. However, this approach will install Python which is the main motive to achieve.
I encountered the same issue after installing a fresh Windows 8.1 on my PC.
I solved that by using the Python v3.9 web installation file which you can find here.
However, you can choose any other version that has a web installation file
Note: You need internet connection to use this method.

How do you Configure Python Keyring to pull credentials from Windows Credential Manager on Windows 7?

I've spent a lot of time researching the keyring package trying to get a simple example to work. I'm using python 2.7 on a windows 7-x64 machine. I've installed the package and confirmed that the files are within my Lib/site-packages folder.
In this code snippet from the installation docs what is supposed to go in "system"?
import keyring
keyring.get_password("system", "username")
When I run the code i get the following error:
RuntimeError: No recommended backend was available. Install the keyrings.alt package if you want to use the non-recommended backends.
It seems like it's not recognizing Windows as the backend. I feel like I'm missing a simple step. Any help is appreciated including a simple code example of pulling generic credentials from Windows Credential Manager.
Finally got this working. The information from Shaun pointed me in the right direction with installing pywin32. From there I did trial and error with creating test credentials in Windows Credential Manager and testing the Python keyring function.
I only got it working with Generic Credentials which is fine for my purposes. I set Internet or network address to "test". Username was set to "test_user". Password was set to "test123". (Quotes included here for instruction, don't include when entering them.
print keyring.get_password("test","test_user")
returned the result "test123"
Hopefully this information helps somebody else. Thanks to Shaun for the direction needed to solve this.
You may have to install the pywin32 package. Doing so solved the problem for me.
Using conda:
conda install -e environment_name_here pywin32
Using pip:
pip install pywin32
On a tangent: For some reason, the code swallows an exception that the windows credential manager class would have otherwise thrown to alert you to this problem. Here's the exception and here's where it's caught and thrown away.
i don't know if you can do that but instead you can ask the user to give it's credentials using this following commands
import admin
if not admin.isUserAdmin():
admin.runAsAdmin()

Python 2.7.5 on Cygwin64: requests installation fails

Our project is a mostly J2EE based development with the automatic functional and integration tests written in Python. The test environment is Linux nonetheless developers use Windows 7 (64-bit). We would like to be able to execute the functional tests on the developer machines as well (before comitting). Unfortunately the pexpect-windows-portability issue would leave us no choice but:
To do some serious refactoring on our test libraries to be able to use both winpexpect (or wexpect) and pexpect depending on the os settings.
Or to use cygwin. Guess what, with this second option we seem to have an issue :-) Using Python 2.7.5 on Cygwin64 installing the requests package results in error:
pip says it can not find a file after downloading and extracting the library
easy install doesn't throw an explicit error, but leaves everything in the temporary dir
after copying the files under the site-packages directory a simple import requests in python causes the interpreter to exit
Has anybody encountered this problem? With Cygwin-32 requests install smoothly. (however we have some other issues - see my next post ;-))
Thank you in advance: Joe, the public
Also ran into the same issues when trying to install requests, all the options on http://docs.python-requests.org/en/latest/user/install/#install did not work. I went to https://github.com/kennethreitz/requests and then clicked on "Download Zip" and I got requests-master.zip.
Update: This should be fixed in Cygwin.
This was a bug in CPython that has been fixed in their master branch. I've pushed a candidate package to the Python maintainer for Cygwin, but you might try this hotfix.
I downloaded from "https://github.com/requests/requests" and then i just ran the setup.py from the requests-master folder ( this was placed in cygwin folder). After that I went to cygwin terminal and then I ran python --> import requests. Voila it worked.

Categories

Resources