gdb.printing not available in python2 - python

First of all, let me start out by saying, I am using gdb version 7.7 built --with-python
the python version is 2.6.x
And No I cannot upgrade them, since I'm limited by the devtools specifically meant for debugging my companies code.
There a lot of useful gdb-python scripts but all of them require me to
import gdb.printing
But I get an import error
(gdb)python import gdb.printing
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named printing
Error while executing Python code.
Is there any way to get the gdb.printing module in this version of gdb and python? (python3 works fine).
I would really appreciate any inputs for this.

Related

problem importing CPX library to use Device Simulator or Visual Sudio Code

I'm following our tutorial. I already had python set up in VSC but I'm trying to use the Device Simulator express now. I'm getting an error when I hit play. It seems the system can't find the library error on line:
from adafruit_circuitplayground import cp
The error is:
Traceback (most recent call last):
File "c:/Users/YayaLenovoFlex/Documents/Python Scripts/trySimulator1.py", line 12, in
from adafruit_circuitplayground import cp
ModuleNotFoundError: No module named 'adafruit_circuitplayground'
Please help. I've very new to Visual Studio Code. I would rather use VSC then the MU editor if I can.
Thanks
Have you installed libraries by this command?
pip install adafruit_circuitplayground

import error does not occurs only when required library is installed while repl is running

I'm trying to test cppyy module in pypy.
cppyy requires reflex library, so I installed it.
without it, an error occurs
>>>> import cppyy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: missing reflection library libcppyy_backend.so
While python repl is still runing, I install reflex library and after that, 'import cppyy' works.
However, when I close the repl and run it again and try to import cppyy, it does not works again(the error above). The point is that only when I install reflex library while repl is running, 'import cppyy' succeeds.
I think that the real problem is not about cppyy or reflex and there have been similiar problems with python repl. Does anyone know how to fix it?
I think you're confused by this behavior of PyPy (which is a bug, should be reported to http://bugs.pypy.org/ ):
If you type import cppyy once, it fails with the ImportError shown above, but inconsistently, trying again immediately import cppyy "works". Of course, you actually get a broken module.
To answer your real question, it seems that you failed to install libcppyy_backend.so. Make sure it is at the right place, as documented.

zipimport.ZipImportError: can't find module from program made with py2exe

I have a python program I wrote that I am trying to "compile" with py2exe, everything goes well and the executable is created. The first time I run the program I get this error:
Traceback (most recent call last):
File "IMGui.py", line 13, in
ImportError: No module named IMCrypt2
I found that if I manually add my custom modules to /lib/shared.zip and run the program again, I get THIS error:
Traceback (most recent call last):
File "IMGui.py", line 13, in
zipimport.ZipImportError: can't find module 'IMCrypt2'
I have been doing some extensive googling, 2 solutions I've found on the web were to delete the 'dist' and 'build' folders and try again, and to add "includes":"decimal" to my options, but neither of these solutions have worked for me D=
I'm using python 2.5 (I was using new version, but building with those were giving me other strange runtime errors, and the version I did successfully build on Windows 7 ONLY worked on Windows 7, so I'm trying again using Python 2.5 on Windows XP in an attempt to get a more 'universal' windows executable)
I'm completely stumped! Any help would be greatly appreciated!
I solved my own problem (kinda), I was able to avoid this error and successfully 'compile' my code by consolidating all my modules in to a single file, so that no custom modules were imported. It resulted in some super messy code, but it worked!

Python2.5, smtplib and KeyError

I'm trying to write a python script for BusyBox on ESXi with mail functionality. It runs Python 2.5 with some libraries missing (i.e. the smtplib). I downloaded Python2.5 sources and copied the lib-folder to ESXi. Now I am trying to import the smtplib via "import lib.smtplib" but Python says:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/pysexi/lib/smtplib.py", line 46, in <module>
import email.Utils
File "/pysexi/lib/email/__init__.py", line 115, in <module>
setattr(sys.modules['email'], _name, importer)
KeyError: 'email'
I'm stuck. So every help and every thought is appreciated!
Trying to install generic applications on an appliance or custom OS is always fun.
Just a guess, but it may be that the email lib is a compiled C module - i.e. not pure python.
I would try use libraries that are as completely python with no compiled code - I don't know if there are pure python versions of the libraries.
The option is to try to track down what OS version that ESXi is based on and then use the matching python version from that OS.
I don't know anything about BusyBox or ESXi - therefore this may be more of a suggestion than an answer, but you might consider using a email service that supports an HTTP or RESTful API - such as MailGun. They have a free plan for up to 200 emails a day, so it might not cost you anything.
Again, this way be more of a suggestion or a plan "B" (if no one can help you with this specific problem)

How to Make a PyMe (Python library) Run in Python 2.4 on Windows?

I want to run this library on Python 2.4 in Windows XP.
I installed the pygpgme-0.8.1.win32.exe file but got this:
>>> from pyme import core
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\Lib\site-packages\pyme\core.py", line 22, in ?
import pygpgme
File "C:\Python24\Lib\site-packages\pyme\pygpgme.py", line 7, in ?
import _pygpgme
ImportError: DLL load failed: The specified module could not be found.
And then this pop up comes up
---------------------------
python.exe - Unable To Locate Component
---------------------------
This application has failed to start because python25.dll was not found. Re-installing the application may fix this problem.
---------------------------
OK
Do I need to "compile" it for Python 2.4? How do I do that?
While the pygpgme project does not clearly document it, it's clear from the error message you got that their .win32.exe was indeed compiled for Python 2.5.
To compile their code for Python 2.4 (assuming they support that release!), download their sources, unpack them, open a command window, cd to the directory you unpacked their sources in, and run python setup.py install. This will probably not work unless you have the right Microsoft C compiler installed (MSVC 6.0 if I recall correctly).
It's no doubt going to be much less trouble to download, install and use Python 2.5 for Windows (it can perfectly well coexist with your current 2.4, no need to remove that). Is that a problem?

Categories