Interfacing Parallel Port in Python - python

I need a tutorial or perhaps more on using Python to print data from a PARALLEL port. Any ideas?
Thanks.

The mentioned PyParallel package is now available on PyPI: https://pypi.python.org/pypi/pyparallel
I tested it successfully with GNU/Linux (Xubuntu 15.10) and Python 3.4.

Have a look at pyserial. http://pyserial.sourceforge.net/ and examples: http://pyserial.sourceforge.net/examples.html
I have some more examples, just need to find them.
Edit: Sorry, I meant pyParallel http://pyserial.sourceforge.net/pyparallel.html
Some examples:
http://orionrobots.co.uk/PyParallel
http://pyserial.svn.sourceforge.net/viewvc/pyserial/trunk/pyparallel/examples/lcd.py?revision=398&view=markup

Related

Python in mac and Windows

Is there any difference in python in both except different operating systems?
I mean if i create a python script in windows, will it run the same in mac too? As long as there is same versions of python in both?
My concern is that I don't have any mac devices to try to run it on so just making sure that I am not doing anything wrong.
Thank you for your help :)
There is no difference.
Python can run on both systems. However, you may be using a module that only works on Windows (e.g. win32api). You can check your module's compatibility on a virtual machine.
If you would like to compile into an application (.exe or .app extension), you will need to use py2app and py2exe which requires you to be on the os respectively. In this case, I suggest that you consider Java or Jython since they are cross platform.
There absolutely no difference between OS. Its a programming lang, only difference would be the IDE you decide to use. Other than that, the way it give O/P to programs is same. Hope it solves your doubt.
Found this discussion revelant to your question. Hope it helps.
https://www.quora.com/Can-I-run-my-Python-program-in-both-Linux-and-Windows

PyGObject in Python 3 on windows

Does anyone know if its possible to install PyGObject/Gtk+3 on windows for Python 3? I have found installers on gnome's website for Python 2 (here), and several statements that it works with Python 3 (e.g. here), but no installer. The compilation instructions all seem to use jhbuild, which from what I can make out is a linux tool. Do I need to compile PyGObject to get it working, and if so, how? Or is there an easier way? What would be great is a guide or howto, but such a ting doesn't seem to exist.
Since this is the most rated question in the topic, I'd like to update the answer. Here is available installer for windows 32bit:
It contain complete SDK-like package. And complete libraries collection too. http://sourceforge.net/projects/pygobjectwin32/files/pygi-aio-3.10.2-win32_rev10-setup.exe/download
I searched for the same thing not so long ago. I couldn't really find much information but this other post
I ended up giving up on GTK+ and switch to xwpython which is really os independant
did you try the offical pypi page https://pygobject.readthedocs.io/en/latest/getting_started.html
I was able to install GTK

Running Scapy on Windows with Python 2.7

I like to use Scapy with Python v2.7 under Windows 7.
How can I install the required module pypcap for Python 2.7?
Will it be possible to make Python scripts depending on Scapy into standalone Windows applications using a distribution tool such as py2exe?
The particular Python distribution I am using is Enthought Python distribution 7.02.
Intrusive update: please note that this answer is outdated, with recent versions (>=2.4.0) scapy will ONLY require Npcap (or Winpcap) to work, and IPython for the console. Have a look at the official windows page
In case someone needs Scapy for 64-bit + Python 2.7, I've uploaded the binaries here:
https://github.com/Kondziowy/scapy_win64
dnet-1.12.win-amd64-py2.7.exe
pcap-1.1.win-amd64-py2.7.exe
scapy-2.2.0.win-amd64.exe
In addition, you probably need to install WinPcap from the official site
Compiling it yourself required a few fixes - I'll commit them upstream soon.
Q: how can i install required module pypcap
Using Scapy with Windows 7 is possible, but it does not exactly work out of the box. An install guide can be found here:
http://www.secdev.org/projects/scapy/doc/installation.html#windows
I strongly recommend to switch to python 2.6, as this will make your live much easier.
When you insist on 2.7 you will have to compile some of the require modules yourself. Also, some key modules like pypcap have to be patched before they can be compiled with python 2.7 (see pycap patch).
Here you will find some guidance on how to build the modules.
Q: will it be possible to make python scripts depending on scapy into standalone windows applications
Yes and no. While you can use py2exe to build a an EXE from your python code. Scapy uses WinPcap which you have to install in addition to your application.
Dirk Loss provides an Windows installer for the dnet package for Python 2.7. Together with the Windows installer for the pypcap package for Python 2.7 I was able to run Scapy successfully on Python 2.7 on Windows.
A LOT OF ANSWERS ARE OUTDATED !
Latest scapy version, that you can download on the official GitHub page:
https://github.com/secdev/scapy
Works without the old hand-compiled dependencies!
They are two easy requirements: IPython (for the console) and npcap (or winpcap)
You may follow the official tutorial here:
http://scapy.readthedocs.io/en/latest/installation.html#windows
Using the link posted by circus, I created binary installations for Scapy for python 2.7.x 32bit. Link for the setups (with dependencies) https://github.com/Kondziowy/scapy_win64
If you don't have limitations forcing you to work with python2, you can try scapy3k from http://github.com/phaethon/scapy or pip install scapy-python3.
It does not require dnet nor pypcap, no C compilation required. I work with following config Windows 10/Anaconda 3.5/latest WinPcap.
Minimum requirement to get Scapy running on Windows with Python 2.7 seems to be: pyreadline, pcapy, and dnet. The last two are the trickiest to compile and/or find pre-compiled binaries. One option for these is listed in the above answer. Another download, together with with detailed steps on how getting Scapy to run on Windows is at: https://github.com/zlorb/scapy. These steps describe also how to get the optional dependencies, such as Gnuplot and Tex.

How to list network interfaces, its configuration IP,netmask and gateway in Python/Windows

I wanna develop a small application to monitor arp and scan arp list in local network.
Currently, I need to retrieve the list of network interfaces and its configuration.
Most of the time I work with Linux, so I don't know much about Win32 API, is there anyway to do this in python way ? I'm using Python 2.6 with PyQt and Scapy (has pywin32 aswell, so if you provide the detail way with win32, I will try)
I found pcapy.findalldevs(), but it cannot retrive configuration. I don't care much about the name, just configuration(IP,netmask) is OK.
For a cross platform solution, I've used netifaces.
Not sure exactly what info you want, but ipconfig /all certainly sounds like what you want:
import subprocess
subprocess.call('ipconfig /all')
For Linux, I use pynetlinux
pip install pynetlinux==1.1
>>> from pynetlinux import ifconfig
>>> ifconfig.Interface("eth0").get_ip()
'192.168.1.66'
Edit:
This is indeed for Linux, for a cross-platform solution, see my other answer.

Windows build for PyLucene+JCC on python 2.6

Where can I download a PyLucene+JCC Windows build compiled for python 2.6?
Jose
I ended up using solr and interfacing it using XML/JSON.
Not tested but there appears to be an egg here:
http://code.google.com/p/pylucene-win32-binary/
you might want to see this recent mailing list post and the related thread. There's also a pylucene-dev thread that seems apropos. Unfortunately, none of these things have what you want; you'll still have to build it yourself.
If you're really feeling charitable, you can publish the steps + binaries once you figure it out, but I don't know.

Categories

Resources