WinPdb Error (Debugging Django) :CTimeoutHTTP instance has no attribute 'getresponse' - django

I am trying to learn winpdb to debug django scripts. I have a very simply django web site that runs find if I start it from the command line, but when I try to launch it from winpdb it gives me this error message:
RPDB2 - The Remote Python Debugger, version RPDB_2_4_6,
Copyright (C) 2005-2009 Nir Aides.
Type "help", "copyright", "license", "credits" for more information.
*** NEW: Use CTRL-N for auto completion in the following commands: launch,
*** eval and exec.
*** Password has been set to a random password.
*** Starting debuggee...
*** Command returned the following error:
*** <type 'exceptions.AttributeError'>, CTimeoutHTTP instance has no
*** attribute 'getresponse'.
*** Please check stderr for stack trace and report to support.
*** Failed to find script.
I don't even know where to start fixing this. It CTimeoutHTTP looks like an MFC thing. I installed wxpython with the ANSI version, then when it complained, I installed the unicode version (without removing the ANSI version.) That is the only unusual thing I can think of. Any help would be appreciated.
I should say, running on Windows XP.

Fixed in Winpdb 1.4.8

This seems to be a bug with rpdb2 in Python 2.7. Try downloading Python 2.6 and running winpdb against that. You'll need the appropriate wxPython library and you'll need to re-run:
python setup.py install -f
to install winpdb.

I also had this exact same error. I upgraded from Winpdb 1.4.6 to 1.4.8 as suggested by nir above and no longer see it (can't vote his answer up as I'm a new user).

Related

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Error after installing Anaconda 2: Fatal Python error: Py_Initialize: unable to load the file system codec

When trying to run a program in python from the terminal I get the following error:
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Current thread 0x00007fffb68a93c0 (most recent call first):
Abort trap: 6
I am currently running Python 3.6.4 :: Anaconda custom (64-bit) and think this problem may have to do with also having Anaconda 2 installed. Could someone help me figure out what the cause is and how I can remedy this?
I'd also be interested in knowing more tips about how to use Anaconda 2 and 3 concurrently so that this doesn't happen again.
After some trouble shooting w/ you, it looks like reinstalling anaconda (from the version 3.6 choice on the web) crossed some wires.
For others either...
1) Use your original installment and make a python3 environment. To do this change your .bash_profile to only include
export PATH="/Users/<username>/anaconda2/bin:$PATH
and perhaps remove or move the
/Users/<username>/anaconda3
directory to a new name. Then make a new environment using the original anaconda(with python version 2) that fetches and uses Python 3.6:
conda create -n mypython3environment python=3.6
where "mypython3environment" is some name you want when you use python 3.6
then to use it in your project - go to your project's directory and type:
source activate mypython3environment
2) Do a clean install. The other option is to cut out the anaconda stuff from your .bash_profile, remove or move the anaconda2/ and anaconda3 directories and the .bash_profile.pysave file and try to reinstall from the anaconda webpage.
Overall - you need to install anaconda once - then use conda create and source activate <environment name> to make then use environments, respectively, with your Python version of choice, whether it is a Python 2 or 3 version.
See Anaconda's Managing Environments and the cheatsheet

jpype startJVM crashes ipython notebook

I'm trying to use JPype within ipython notebook in order to use JIDT (I don't know Java). I'm following the instructions here: https://code.google.com/p/information-dynamics-toolkit/wiki/PythonExamples.
I import jpype and start the java virtual machine with:
from jpype import *
startJVM(getDefaultJVMPath())
This makes the ipython notebook kernel crash due to the following error:
python(490,0x7fff7a99e310) malloc: *** error for object 0x104d90720: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
However, it works fine in the ipython shell.
How can I know where the error comes from and how can I fix it?
I use:
OSX 10.9.5
Python 2.7.10,Anaconda 2.2.0,IPython 3.1.0
Any help will be greatly appreciated.
I think it has to do with the C compiler used to install JPype. Try setting C compiler to clang and install JPype like this:
$env CC=clang python setup.py install

Error installing pyMPI on CentOS 5.9

I'm trying to make a local install of pyMPI on a server running CentOS 5.9 (i.e. I don't have sudo privileges). The ./configure step completes successfully, however there a lot of "no"s. When i try running make i get a lot of "deprecated" error messages and the process exits with error code 2. Can anyone help me with this please?
The results of running
./configure --prefix=/inside/home/aarjunrao/apps/py_modules/pyMPI
are as follows
./configure output
I then run make, which gives the output
make output
Thanks in advance,
Arjun
From your make output, line 305:
pyMPI_util.c:22:31: error: numpy/arrayobject.h: No such file or directory
Is NumPy installed on this system? If not, that's probably your problem...
You can use this option in the configure process
./configure --prefix=/inside/home/aarjunrao/apps/py_modules/pyMPI --with-includes='-I/[path_to_numpy]/core/include'
In my case, it is
--with-includes='-I/usr/local/lib/python2.7/site-packages/numpy/core/include'
Doing that, you don't need to modify the system PATH.

Mac/Django error message: "/mercurial/osutil.so: no appropriate 64-bit architecture"

I'm new to Macs (and quite new to Django) and I'm setting up an existing Django/MySQL site that uses Mercurial as a site package, on a new Macbook Pro.
All was going well during installation - no error messages. I installed the default versions of most packages from macports.
However when I try runserver, localhost shows the following error message:
ImportError at /
.../lib/python2.6/site-packages/mercurial/osutil.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
Please could anyone advise? I've tried typing the following at the terminal:
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
but it didn't help.
I've gotten a similar error and a combination of two things helped me install Mercurial for OS X Lion. I'm running OS X 10.7.3.
First, there is a bug on line 455 of the setup.py script (at least for Mercurial 2.2.1, the version I tried). The line
version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
should be replaced with
version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0]
Second, after I installed Mercurial (either by easy_install, Mac OS X binary installer, and compilation), I kept getting the following error message:
ImportError: dlopen(/Library/Python/2.7/site-packages/mercurial/osutil.so, 2): no suitable image found. Did find: /Library/Python/2.7/site-packages/mercurial/osutil.so: mach-o, but wrong architecture
However, after seeing this post, I noticed that
defaults read com.apple.versioner.python Prefer-32-Bit
outputs 1 on my system. However, running this command
defaults write com.apple.versioner.python Prefer-32-Bit -bool no
and then recompiling / installing mercurial resulted in a working executable for me at the end.
If everything from my comment checks out, try setting that Prefer-32-bit in an user environment variable instead of at the command line.
Edit this file: ~/.MacOSX/environment.plist
See:
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html#//apple_ref/doc/uid/20002093-113982