if I type python in win cmd, it's ok.But when I run python main.py from cmd it crashed.
The message is:
python.exe has stopped working.
Problem signature:
Problem Event Name: APPCRASH
Application Name: python.exe
Application Version: 0.0.0.0
Application Timestamp: 4c73f7b6
Fault Module Name: python26.dll
Fault Module Version: 2.6.6150.1013
Fault Module Timestamp: 4c73f79a
Exception Code: c0000090
Exception Offset: 000c30a2
OS Version: 6.1.7600.2.0.0.256.48
Locale ID: 2052
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
Post-mortem: the problem was solved inside question comments (re-installing Python fixed the problem; I suspect the Python installation had somehow gotten corrupted).
Related
I'm using
Mac OSX High Sierra
anaconda3 python (virtual environment with python=3.6)
Matlab R2018a.
Steps to reproduce:
Create a new python 3.6 environment. Activate the environment
Go to Matlab/extern/engines/python and run python setup.py install.
Run the following script.
import matlab.engine
matlab.engine.start_matlab()
Segmentation fault happen at the start_matlab() line (not the import line).
I had no trouble before using matlab engine this way. How could I debug this? (mostly is just linking problem).
======================
I uninstalled Anaconda3, and used Python 2.7 system. I met with the same problem, and the problem is with libwmvm.dylib of Matlab.
Process: Python [5124]
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.7.10 (2.7.10)
Code Type: X86-64 (Native)
Parent Process: bash [2183]
Responsible: Python [5124]
User ID: 501
PlugIn Path: /Applications/MATLAB_R2018a.app/bin/maci64/libmwmvm.dylib
PlugIn Identifier: libmwmvm.dylib
PlugIn Version: ??? (0)
Date/Time: 2018-04-27 23:27:03.250 +0700
OS Version: Mac OS X 10.13.4 (17E199)
Report Version: 12
Anonymous UUID: 885790DC-B32C-0363-903C-837A7C285AF3
Sleep/Wake UUID: 14FBD560-D2B9-4A59-89F1-DABA878FCA70
Time Awake Since Boot: 10000 seconds
Time Since Wake: 3700 seconds
System Integrity Protection: enabled
Crashed Thread: 3
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000090
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
VM Regions Near 0x90:
-->
__TEXT 000000010e1c6000-000000010e1c8000 [ 8K] r-x/rwx SM=COW p [/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Thread 0:: Dispatch queue: com.apple.main-thread
Matlab engine is not supported by python 3.6, you can use python 3.5.
I have anaconda, python 2.7, 3.5 and 3.6 also.
You can easily differentiate between them by renaming the python.exe to python35.exe for instance. Than you can call you py srcipt like this:
python35 example.py
And it will call it with python35.
Hint:
pip install and conda install won't work after the renaming, since it's searching for python.exe, so you don't have to rename the anaconda and the python version what you are using in most of the case.
I'm using PyDev installed as an Eclipse extension (through the update site) on Windows 7 and WinPython 3.6.0.1. I can run code just fine even though the syntax checker is broken, i.e., marks as error "Undefined variable: print" lines as simple as
print("hello")
I think the issue is connected with this error I get in the error log as soon as I start Eclipse:
Error creating python process - exited before creating sockets - exitValue = (1).
This is the Exception stack trace
java.lang.RuntimeException: Error creating python process - exited before creating sockets - exitValue = (1).
ProcessInfo:
- Executed: C:\tools\winpython\3.6.0.1\python-3.6.0.amd64\python.exe -u C:\Portables\Eclipse\plugins\org.python.pydev_5.9.2.201708151115\pysrc\pycompletionserver.py 55270
- Environment:
ALLUSERSPROFILE=C:\ProgramData
[... list of all the environment variables ...]
- Working Dir:
C:\Portables\Eclipse\plugins\org.python.pydev_5.9.2.201708151115\pysrc
- OS:
Windows 7
- Std output:
- Err output:
Traceback (most recent call last):
File "C:\Portables\Eclipse\plugins\org.python.pydev_5.9.2.201708151115\pysrc\pycompletionserver.py", line 13, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTHON
ModuleNotFoundError: No module named '_pydevd_bundle'
at org.python.pydev.core.log.Log.log(Log.java:54)
at org.python.pydev.editor.codecompletion.shell.AbstractShell.startIt(AbstractShell.java:290)
at org.python.pydev.editor.codecompletion.shell.ShellsContainer.getServerShell(ShellsContainer.java:232)
at org.python.pydev.editor.codecompletion.shell.ShellsContainer.getServerShell(ShellsContainer.java:165)
at org.python.pydev.editor.codecompletion.shell.AbstractShell.getServerShell(AbstractShell.java:222)
at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.createTokensFromServer(CompiledModule.java:372)
at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.<init>(CompiledModule.java:176)
at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getBuiltinModule(SystemModulesManager.java:332)
at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getBuiltinModule(SystemModulesManager.java:1)
at org.python.pydev.ui.interpreters.AbstractInterpreterManager.getBuiltinMod(AbstractInterpreterManager.java:146)
at org.python.pydev.ui.interpreters.AbstractInterpreterManager.getBuiltinCompletions(AbstractInterpreterManager.java:118)
at org.python.pydev.plugin.nature.PythonNature.getBuiltinCompletions(PythonNature.java:1126)
at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getBuiltinComps(AbstractASTManager.java:1801)
at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getBuiltinCompletions(AbstractASTManager.java:1787)
at com.python.pydev.analysis.scopeanalysis.AbstractScopeAnalyzerVisitor.<init>(AbstractScopeAnalyzerVisitor.java:151)
at com.python.pydev.analysis.visitors.OccurrencesVisitor.<init>(OccurrencesVisitor.java:105)
at com.python.pydev.analysis.OccurrencesAnalyzer.analyzeDocument(OccurrencesAnalyzer.java:50)
at com.python.pydev.analysis.builder.AnalysisBuilderRunnable.doAnalysis(AnalysisBuilderRunnable.java:271)
at com.python.pydev.analysis.builder.AbstractAnalysisBuilderRunnable.run(AbstractAnalysisBuilderRunnable.java:162)
at org.python.pydev.core.concurrency.RunnableAsJobsPoolThread$1.run(RunnableAsJobsPoolThread.java:140)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
So, apparently the error is this
ModuleNotFoundError: No module named '_pydevd_bundle'
I tried reinstalling PyDev (it looks like the installation might be broken), but to no avail. Ideas?
I might have actually found the issue. I discovered the WinPython distribution I installed was "WinPython Zero", which comes with no additional packages. I uninstalled it and installed the "default" WinPython; now the debugger is working as expected. I suppose then there's some library needed to enable debugging. Maybe a more informative error message would help here, as this one I got really doesn't say much.
Funny thing, that's exactly what happens in PyCharm too: https://youtrack.jetbrains.com/issue/PY-24198
I used Ubunto 16.04, Lttng 2.8.1 and python3.5.2. I also installed python3-babeltrace package. The first step was I recorded some logs exactly based on Lttng documents with lttng create, evenet-enable, start, stop, destroy. In the second step I write a very simple python program to read lttng events, some thing like this:
from collections import Counter
import babeltrace
import sys
print("Start")
trace_path = sys.argv[1]
print("1-Get Path")
col = babeltrace.TraceCollection()
print("2-TraceCollection")
# (LTTng traces always have the 'ctf' format)
if col.add_trace(trace_path, 'ctf') is None:
raise RuntimeError('Cannot add trace')
print("3-Add trace by ctf")
for event in col.events:
print(event.name)
print("4-Get all events")
then I debug the program with gdb and after this outputs:
Start
1-Get Path
2-TraceCollection
3-Add trace by ctf
I got the error:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff565d97f in bt_iter_add_trace ()
from /usr/lib/x86_64-linux-gnu/libbabeltrace.so.1
Does any one have any idea about this?
I uninstall all of the packages, also uninstall ubuntu and then installed again but each time I got the same error.
I also try to install Ubuntu 16.10 but with that one I got another error in lttng-module package installation.
Update:
I found that none of babeltrace command and lttng view not worked, and caused the segmentation fault error.
I use PyCharm/IntelliJ community editions from a wile to write and debug Python scripts, but now I'm trying to debug a Python module, and PyCharm does a wrong command line instruction parsing, causing an execution error, or maybe I'm making a bad configuration.
This is my run/debug configuration:
And this is executed when I run the module (no problems here):
/usr/bin/python3.4 -m histraw
But when I debug, this is the output in the IntelliJ console:
/usr/bin/python3.4 -m /opt/apps/pycharm/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 57851 --file histraw
/usr/bin/python3.4: Error while finding spec for '/opt/apps/pycharm/helpers/pydev/pydevd.py' (<class 'ImportError'>: No module named '/opt/apps/pycharm/helpers/pydev/pydevd')
Process finished with exit code 1
As you can see, the parameters are wrong parsed, and after -m option a IntelliJ debug script is passed before the module name.
I also tried just put -m histraw in the Script field, but doesn't work, that field is only to put Python script paths, not modules.
Any ideas?
There is another way to make it work.You can write a python script to run your module.Then just configure PyCharm to run this script.
import sys
import os
import runpy
path = os.path.dirname(sys.modules[__name__].__file__)
path = os.path.join(path, '..')
sys.path.insert(0, path)
runpy.run_module('<your module name>', run_name="__main__",alter_sys=True)
Then the debugger works.
In PyCharm 2019.1 (professional), I'm able to select run as module option under configurations, as below
I found it easiest to create a bootstrap file (debuglaunch.py) with the following contents.
from {package} import {file with __main__}
if __name__ == '__main__':
{file with __main__}.main()
For example, to launch locustio in the pycharm debugger, I created debuglaunch.py like this:
from locust import main
if __name__ == '__main__':
main.main()
And configured pycharm as follows.
NOTE: I found I was not able to break into the debugger unless I added a breakpoint on main.main() . That may be specific to locustio, however.
The problem is already fixed since PyCharm 4.5.2. See corresponding issue in PyCharm tracker:
https://youtrack.jetbrains.com/issue/PY-15230
I'm trying to get a response from Nagios by using the following Python code and instructions:
http://skipperkongen.dk/2011/12/06/hello-world-plugin-for-nagios-in-python/
From some reason I never get to have OK from Nagios and it's always comes back with the message: Return code 126 is out of bounds - plugin may be missing
I installed nagiosplugin 1.0.0, and still nothing seems to be working
In parallel I have some other services (not python files) that work e.g. http check, current users, and SSH
What am I doing wrong? I'm trying to solve that for few days already
Getting Nagios to utilize your new plug-in is quite easy. You should make changes to three files and restart Nagios — that’s all it takes.
The first file is /etc/nagios/command-plugins.cfg (leave comment please if you know path to this file or analog in ubuntu). Assumed that plugin file is placed in /usr/lib/nagios/plugins/ directory:
command[check_hello_world]=/usr/lib/nagios/plugins/check_helloworld.py -m 'some message'
Drop down one directory to /etc/nagios/objects/commands.cfg (for ubuntu user should create cfg file in that dir /etc/nagios-plugins/config/):
define command {
command_name check_hello_world
command_line $USER1$/check_hello_world.py -m 'some message'
}
Save the file and open up /etc/nagios/objects/localhost.cfg (in ubuntu path to service definition files located in /etc/nagios3/nagios.cfg and by default cfg_dir=/etc/nagios3/conf.d. So, to define new service in ubuntu user should create cfg file in that dir, for example hello.cfg). Locate this section:
#
# SERVICE DEFINITIONS
#
and add new entry:
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Check using the hello world plugin (always returns OK)
check_command check_hello_world
}
All that remains is to restart Nagios and to verify that plug-in is working. Restart Nagios by issuing the following command:
/etc/init.d/nagios restart
http://www.linux-mag.com/id/7706/
ubuntuforums.org - Thread: My Notes for Installing Nagios on Ubuntu Server 12.04 LTS
I had to prepend the path to python2.7 even though the shebang in the file specified it.
In the command definition I had this:
command_line /usr/local/bin/python2.7 $USER1$/check_rabbit_queues.py --host $HOSTADDRESS$ --password $ARG1$
Even though the top of the actual python file had:
#!/usr/bin/env python2.7
Even though the script executed and returned just fine from the command line without specifying the interpreter.
Nothing else I tried seemed to work.