failing to install and start windows service with winreg imported - python-3.x

So I'm building a pretty simple service in python3.6. Client want's it to run on windows, so I'm using the win32serviceutil package to make a windows service. I install and package with pyinstaller and so far everything works great.
The issue I'm having is that the path differs between installing, starting and debugging. When installing and debugging, the path is the same as where I run the command from. When starting the service however, the path is C:/windows/system32
The service needs to boot another .exe so it is important having an absolute path to the bundled application. I solved this by writing the path to registry when installing, and reading when starting the service. I do this using the winreg lib. It works great in debug mode, but it seems the service is run under another user when starting the service normally, and it fails to load somehow.
I get Error 1053 : The service did not respond to the start or control request in a timely fashion when running. Importing the winreg lib is fine, but when using it crashes with no error. I'm trying to catch the errors and print but I get nothing on command prompt or the Event Viewer.
Any help appreciated!!

Related

Powershell script execution from node js fails

I have a list of Powershell scripts that we've developed for a system administration. These scripts are called/executed from a Node JS application using "child_process" module. Everything works fine on my laptop. After transferring Node JS application to Centos7 server I'm receiving errors like this one:
The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I've checked Powershell execution policy - everything is set to Unrestricted. I can execute the same scripts from the command line without any error after I ssh to the server as a root user. The only difference I see is that Node JS application is running using a different user.
Found the problem - all modules were installed under /root/.local/share/powershell/Modules directory and nothing was installed under the user's profile that runs Node JS application. Copied all modules under app user directory /home/ndjs/.local/share/powershell/Modules/ and everything work now.

Python unable to start correctly ( 0xc0000005)

i just install python 3.7 and also config the path.but when i type python in cmd its showing me "the application is unable to start correctly 0xc0000005"
The application was unable to start correctly (0xc0000005).click ok to close the Application
For me, this happened because ordinary users didn't have read+execute access on the following file:
C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll
This was discovered by running Sysinternals' Process Monitor to see what the Python3 thread was doing.
HTH

How to run Flask CLI from within PyCharm under Windows

I've been trying to get the Flask CLI to debug from within PyCharm with no success. I've tried the recommended procedures listed here. However, this doesn't work under Windows since flask.exe is an executable and not a script. Renaming flask.exe to flask does not work either. This causes the following exception:
Jetbrains has an active incident report in YouTrack for this, but there's been no activity done on it yet, with the Kanban State set to "Not On Board", so it looks like it's going to be sometime before the issue is addressed.
Any help would be greatly appreciated.
EDIT: Using Pycharm run works properly. Trying to run using the Pycharm debugger causes the exception
EDIT 2: Results after creating flask_debug.py file as recommended:
Firstly, rename flask.py back to flask.exe.
In PyCharm's Run Configuration dialog manually enter the full path to the Flask executable in the Script: text box. Don't use the browse button as it filters on Python scripts (.py files).
See screenshot. In this instance there is a virtual environment called "href" and the flask executable is in the Scripts sub-directory.
To use PyCharms's debugger create a file in the root say flask_debug.py:
from flask.cli import main
if __name__ == '__main__':
main(as_module=False)
Then setup PyCharm to run this script passing any Flask CLI parameters as required. See screenshot below showing Run/Debug configuration and the debugger stopped at a breakpoint.
Below shows Flask 0.12.2 quickstart app running under the PyCharm debugger and showing the defined environmental variable FLASK_APP.
In the latest version of PyCharm, there's an option to run by Module name instead of by file. Using "flask" as the module name works as well and doesn't require you to create a flask_debug.py file.
I'm attaching the screenshot of the working fileset and the Run/Debug Configuration for reference. This answer is thanks to the support provided by pjcunningham.

Running Azure node.js Tools on Ubuntu

I have followed these instructions.
And as far as I can tell I have successfully installed node.js azure tools. No error - nothing to suggest it failed.
However, I cannot, and the documentation says, simple run "azure"...
Maybe there is something I am missing with node.js?
There are a few problems you may be experiencing.
First of all, I would ensure you are running Node.js v0.6.20. You can do this by opening the command prompt and running:
node -v
You should have v0.6.20 echoed back.
If this doesn't work, you may be missing a path variable to Node.js or the NPM cache. Verify the Environment variables exist by running [in the command prompt]:
path
you should see two paths:
%appdata%\npm
[x64 Machine]
%programfiles(x86)%\nodejs\
[x86 Machine]
%programfiles%\nodejs\
If this doesn't work, I would check to ensure that the azure module was loaded into the %appdata%\npm\node_modules directory.
It could be the PATH issue. In my case, the azure program is located at ~/.npm-global/bin.
run "export PATH=$PATH:~/.npm-global/bin". Or just add to bash source file

unable to symbolicate crash log from a MonoTouch program

I have a MonoTouch app that I built in debug and uploaded to the device. I ran the app in the debugger and the app died without the debugger catching anything. I have a .crash log for it. I ran:
symbolicatecrash myapp.crash myapp.dSYM
It got symbol information for Apple stuff like CFRunLoopRunInMode and UIApplication, but not for anything in my program.
Is there a different way I need to symbolicate MonoTouch crash logs?
We had this same problem and we created a work around...
When we ran symbolicatecrash with the -v parameter (verbose) we saw it was complaining about not having a binary file inside the dSYM package. So we manually copied the binary file from within the app package into the dSYM package and that worked. Something like [MyProject].app/[MyProject] to [MyProject].app.dSYM/[MyProject].
We then created this as a Custom Command to run After Build:
cp ${TargetDir}/${ProjectName}.app/[MyProject] ${TargetDir}/${ProjectName}.app.dSYM/${ProjectName}
Note the [MyProject] portion as the binary created in the app package is a different name than the project name for us for some reason.
Now all builds symbolicate fine from terminal and within Xcode organizer. I hope there's a less band-aid way, but we were in a time crunch and this worked.
I had this problem and posted a patched version of symbolicatecrash to github. Replace /usr/local/bin/symbolicatecrash with this and you should be back in business.
tholsens answer is correct but when using Xcode >=4.3 (which is installed as an application) you need to run xcode-select first:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Otherwise you'll get strange errors like 'does not contain slice armv6', etc.

Resources