MacVim vdebug python error - python

I am trying to use vdebug with MacVim and xdebug to debug code. I have MacVim and python installed via homebrew and xdebug is installed and working fine with MacGDBp.
When I listen in vdebug with the F5 key and reload a page (xdebug remote autostart is on) I get a python error in the vdebug quickfix window:
An error occured: <type 'exceptions.ImportError'>
Traceback (most recent call last):
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/start_vdebug.py", line 31, in run
self.runner.run()
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/vdebug/runner.py", line 160, in run
self.open()
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/vdebug/runner.py", line 74, in open
raise e
ImportError: No module named expat; use SimpleXMLTreeBuilder instead
I've googled this for a while and can't find a working solution. Any ideas?

This worked for me! Posted in case anyone else has the same problem:
https://stackoverflow.com/a/12697440/557215
It temporarily links the homebrew version of python to the mac system version before reinstalling MacVim. Now xdebug works!

Related

pdfplumber to_image() OSError: exception: access violation writing 0x0000000000000008 in Windows 10

I was trying to use pdfplumber library in python (ver. 3.10.6) to convert some pdf pages to images but pdfplumber to_image() method throws the following error:
import pdfplumber
>>> myDOc = pdfplumber.open("CV.pdf")
>>> myImg = myDOc.pages[0].to_image(resolution=300)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jjjku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pdfplumber\page.py", line 381, in to_image
return PageImage(self, **kwargs)
File "C:\Users\jjjku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pdfplumber\display.py", line 93, in __init__
self.original = get_page_image(
File "C:\Users\jjjku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pdfplumber\display.py", line 54, in get_page_image
with WandImage(
File "C:\Users\jjjku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wand\image.py", line 9306, in __init__
wand = library.NewMagickWand()
OSError: exception: access violation writing 0x0000000000000008
Initially I tried to use this method from PyCharm but thiserror occurred, after that I assumed that maybe something is wrong with PyCharm configuration, so I tried the same from cmd and the result is above (the same error as in PyCharm). I suspect that there is something wrong with my Image Wand or Ghostscript configuration. I have Windows 10 on my computer. I tried some ideas from the net but without results.
Does anyone have any idea what can be the cause of this error and how to make it work?
So, following the advice, I reported it as a bug on pdfplumber project GitHub and I got a response that this is related to some problems with Wand library dependencies. The issue was resolved after I installed the following package:
pip install -U wand
In PyCharm I added Wand package to Python Interpreter Packages (make sure to have version 0.6.10, for 0.6.9 the error still occurred from what I observed)

Pycharm says "tarfile.ReadError: file could not be opened successfully"

Today I tried to create a new python project unsing Pycharm, with Python3.2. But I figured out that something is wrong.
When I tried to find the path of my python interpreter, I get that one:
Python 3.2 (r32, Apr 18 2018)
>>> import sys
>>> print(sys.executable)
/usr/local/bin/python3.2
So I put this path on the filling section Base interpreter.
Windows python interpreter Pycharm Project
But when pressing button Create project, this error occurs:
Traceback (most recent call last):
File "/home/David/pycharm-community-2018.1.1/helpers/packaging_tool.py", line 159, in main
retcode = do_untar(name)
File "/home/David/pycharm-community-2018.1.1/helpers/packaging_tool.py", line 100, in do_untar
tar = tarfile.open(name)
File "/usr/local/lib/python3.2/tarfile.py", line 1744, in open
raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully
Could someone tell me what is wrong? Thanks.
I've got stuck with exactly the same thing and found the answer here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206601205-Can-t-Install-setuptools-from-within-PyCharm-on-Linux?page=1
You have to compile zlib and recompile python with zlib headers path.
Here's how to compile Python (don't forget the -with-zlib part):
https://stackabuse.com/install-python-on-mac-osx/#installpythonfromsource

Error installing pyflycapture2 on Windows

I am attempting to install this https://github.com/jordens/pyflycapture2 python binding on my Windows machine. The readme only has instructions on how to do it for Linux systems, but I imagine the library should still work.
I am able to run "python setup.py install" and it seems to successfully complete, but when I try to run "python test_flycapture2.py" I get this error:
C:\Users\clinic\Desktop\pyflycapture2>python test_flycapture2.py Traceback (most recent call last):
File "test_flycapture2.py", line 20, in <module>
import flycapture2 as fc2
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
This seems to imply that flycapture2 wasn't installed correctly. When I instead just open a python session and do "import flycapture2" I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Have I done something wrong with the installation process or does pyflycapture2 just not work with Windows?
A dumb solution that's worth a try. There are chances that the DLL are searched directly from where you're starting the python script. So if you have the dll somewhere on your computer, copy it along where you have your test_flycapture2.py.
But given the fact that the setup.py file has a whole bunch of absolute paths in there, I would not place my hopes too high. You can also try to install FlyCapture 2 at the exact same path, run python setup.py bdist_wheel (you will need to install wheel first with pip) in the pyflycapture2 folder, and see if that succeeds.
If it does, try installing the generated wheel (that will be in dist/ subfolder) by doing pip install dist/pyfly....wheel and test again.
Hope this helps
I'm answering this mostly because I found another post where the same question had been posted but the original problem was never answered.
How do I run an installed Python module on Windows?
In the comments, the original poster says that it suddenly started working. I found that the solution was simply to restart my computer. I have now attempted this on two computers and this worked for both of them.

Error getting Scapy to work on Windows: "'module' object has no attribute 'ex_name'"

I'm trying to run a Python script that involves ARP sniffing and is apparently dependent on the Scapy library being present. I have absolutely no idea what I'm doing but I'm reasonably good at Googling, following directions, and copying/pasting. I have it up and running on my Mac, but I'm stuck on what I hope is the last hurdle in getting Scapy working on my Windows computer (which is ultimately the one that needs to be running this script).
I followed all of the instructions at http://www.secdev.org/projects/scapy/doc/installation.html#windows, except that I chose Python 2.7 and used the newer 2.7-compatible versions of everything listed there. I used “python setup.py install” (successfully, as best I could tell) on all installs except Pypcap and Libdnet, which I installed via the Exe as an Administrator as instructed.
Unfortunately, when I type "scapy" into the command prompt to test if it works, I get the following information & error message:
C:\scapy-2.3.1>scapy
INFO: Can't import python gnuplot wrapper . Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
Traceback (most recent call last):
File "C:\Python27\Scripts\\scapy", line 25, in <module>
interact()
File "C:\Python27\lib\site-packages\scapy\main.py", line 278, in interact
scapy_builtins = __import__("all",globals(),locals(),".").__dict__
File "C:\Python27\lib\site-packages\scapy\all.py", line 16, in <module>
from arch import *
File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 79, in <module>
from windows import *
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 214, in <module>
ifaces.load_from_dnet()
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 173, in load_from_dnet
self.data[i["name"]] = NetworkInterface(i)
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 93, in __init__
self.update(dnetdict)
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 107, in update
self._update_pcapdata()
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 118, in _update_pcapdata
win_name = pcapdnet.pcap.ex_name(guess)
AttributeError: 'module' object has no attribute 'ex_name'
Can anyone help me out? If you need more information please let me know.
I am running Windows 10.
Thanks in advance,
- Ethan
I had same problem.
To solve it, i downloaded dnet-1.12.win32-py2.7.exe
and pcap-1.1.win32-py2.7.exe.
You might want to try with Scapy's current development version (from the Github repository). Support for Windows has been updated recently and should work without the need of Libdnet.
If that's not the case, you should probably open an issue.
Try it with scapy3k. Install python3 (e.g. I use Anaconda 3.5), and WinPcap driver. You do not need dnet or pypcap. Install using pip install scapy-python3 or from http://github.com/phaethon/scapy

nxt-py no backends error

i am trying to run one of the example scripts for nxt py library using pyusb. whenever i try to run the examples i get the following error:
USB module unavailable, not searching there
Bluetooth module unavailable, not searching there
Traceback (most recent call last):
File "C:\Documents and Settings\*\Desktop\nxt-python-2.2.1\examples\mary.py", line
15, in <module>
b = nxt.locator.find_one_brick()
File "C:\Python27\lib\site-packages\nxt\locator.py", line 112, in find_one_brick
for s in find_bricks(host, name, silent, method):
File "C:\Python27\lib\site-packages\nxt\locator.py", line 80, in find_bricks
raise NoBackendError("No selected backends are available! Did you install the comm
modules?")
NoBackendError: No selected backends are available! Did you install the comm modules?
i have no idea how to fix this and i was wondering if there was any other way than just switching to bluetooth?
USB and Bluetooth are unavailable. You need to install python modules to be able to run examples.
Here is installation guide,
choose your operating system.
For me (mac os x) works only fantomusb. Also I needed to set attributes for brick locator to find it trought fantomusb.
b = nxt.locator.find_one_brick(name="NXT", strict=True, method=nxt.locator.Method(bluetooth=False, fantomusb=True, fantombt=False, usb=False))

Categories

Resources