Is there a Mac alternative to the Windows Python extension, pyHook? I need to catch keystrokes outside of the python app; In any other software.
I've googled like hell an haven't found anything.
Cheers.
Short answer, No
This extenstion was designed specifically for windows
System Requirements
Windows 2000 or later (low-level hooks are not supported in earlier versions of Windows)
Python 2.4 or later
PyWin32 (formerly known as win32all extensions)
Source: http://sourceforge.net/apps/mediawiki/pyhook/index.php?title=Main_Page
Related
I would like to use my Raspberry Pi for some programming. (never done it before, I want to get into Python.) If I can transfer my programs yo my Windows 8.1 computer and run them there also, that would be perfect. Can I do that? Thanks!
Yes! Python code is mostly platform independent. Only some specific libs must be compiled in the Maschine. These should be installed using pip (if needed). More info in Google.
Short answer: Yes.
Long answer: That is the whole point actually. Just make sure you install proper python version on your Windows machine, and set up path properly in order to be able to start your python scripts globally. Here is a nice resource - https://docs.python.org/2.7/using/windows.html. Once you set it up, you just need to transfer your .py files from Raspberry Pi to Windows machine.
Short answer: mostly yes, but it depends.
Obviously, the Raspberry Pi specific libraries for controlling its peripherals won't work on ms-windows.
Your Pi is probably running a Linux distribution that has package management and comes with a functioning toolchain. That means that installing (python) packages and libraries will be a breeze. Tools like pip and setup.py scripts will mostly Just Work.
That is not necessarily the case on ms-windows.
Installing python libraries that contain extensions (compiled code) or require external shared libraries is a frustrating epxerience for technical reasons pertaining to the microsoft toolchain. On that OS it is generally easier to use a python distribution like Anaconda that has its own package manager, and comes with packages for most popular libraries.
Furthermore, if you look into the documentation for Python's standard library you will see that sometimes a function is only available on UNIX or only on ms-windows. And due to the nature of how ms-windows creates new processes, there are some gotchas when you are using the multiprocessing module.
It would be a good idea to use the same Python version on both platforms. Currently that would be preferably 3.6 or 3.5.
I have written a program in Python 3 that relies on another program in Python 2.7 for some core tasks. It works seamlessly on gnunux since most distribution have already 2.7 installed, I just have to require Python 3, and it's all good.
But now I want to port the bundle to Windows, and I don't know how to manage this. I have the following issues
Most Windows don't have Python installed, never mention both 2.7 and 3 series.
The scripts invoke various utilities (executables, Python 2.7 & 3 scripts) with subprocess.call(... shell=True) and relies on Python scripts' shebangs to use the right version. As far as I know, there is no way to emulate such behaviour on Windows.
I use dynamic imports to implement some kind of plugin behavior, it is perhaps not the best possible design, but it would be sweet if I had not to refactor this for now
I have the source code for everything I use, and everything is under libre licenses, so I don't have issues with compiling to PE or porting 2.7 scripts to 3, but it would be a tedious work. The only solution I have found so far is to port everything to Python 3. Can you think of another one?
The recent Python Launcher for Windows (see also PEP 397) could be used to simulate the shebang/version behaviour. However, if you want to do this, the different versions of python must be installed on the system of course (and the launcher as well, registered as the default application for .py files)
Tools like PyInstaller and py2exe can bundle dynamically imported modules, only not discover them all by itself: you'll have to specify them yourself. I think your problem with these tools will be that they do not make applications with different versions of Python at the same time.
So I guess you're left with either requiring installation of python 2.7 and python 3 on the target system, or making separate exe's for your 2.7 and 3 scripts, and changing your subprocess calls to call these instead. (you could bundle the python installations with your own instead of using standard system-wide python installs, but you'd still have to
change your subprocess calls instead of relying on windows default application for file extensions)
How about using PyInstaller? Never used it myself but:
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X.
http://www.pyinstaller.org/
So you could convert both your programs to executables and then call one from inside the other.
I have a lovely Macbook now, and I'm enjoying coding on the move. I'm also enjoying coding in Python. However, I'd like to distribute the end result to friends using Windows, as an executable.
I know that Py2Exe does this, but I don't know how portable Python is across operating systems. Can anyone offer any advice? I'm using PyGame too.
Many thanks
The Python scripts are reasonably portable, as long as the interpreter and relevant libraries are installed. Generated .exe and .app files are not.
Py2exe generates Windows executables, so they will only work on the Windows Platform. The FAQ at http://www.py2exe.org/index.cgi/FAQ has more information on how it all works. Essentially it provides what is needed to run on Win9x as well as more current platforms. NOTE: the FAQ mentions some potential gotchas with character encodings and the work arounds.
With python, it is common enough on Unix based systems, as several Linux distributions have their custom maintenance scripts written in the language. So the Python scripts will be just as portable as Ruby scripts, etc. As long as the target machine has the interpreter and you are not using external programs that are only on one type of platform, others will be able to use your work.
Personally I experienced huge difficult with all the Exe builder, py2exe , cx_freeze etc. Bugs and errors all the time , keep displaying an issue with atexit module.
I find just by including the python distro way more convinient. There is one more advantage beside ease of use.
Each time you build an EXE for a python app, what you essential do is include the core of the python installation but only with the modules your app is using. But even in that case your app may increase from a mere few Kbs that the a python module is to more than 15 mbs because of the inclusion of python installation.
Of course installing the whole python will take more space but each time you send your python apps they will be only few kbs long. Plus you want have to go to the hussle of bundling the exe each time you change even a coma to your python app. Or I think you do , I dont know if just replacing the py module can help you avoid this.
In any case installing python and pygame is as easy as installing any other application in windows. In linux via synaptic is also extremly easy.
MACOS is abit tricky though. MACOS already come with python pre installed, Snow leopard has 2.6.1 python installed. However if you app is using a python later than that and include the install of python with your app, you will have to instruct the user to set via "GET INFO -> open with" the python launcher app which is responsible for launcing python apps to use your version of python and not the onboard default 2.6.1 version, Its not difficult and it only takes a few seconds, even a clueless user can do this.
Python is extremely portable, python pygame apps cannot only run unchanged to the three major platform , Windows , MACOS ,Linux . They can even run on mobile and portable devices as well. If you need to build app that runs across platform , python is dead easy and highly recomended.
If you are planning to include Linux in your portability criteria, it's worth remembering that many distributions still package 2.6 (or even 2.5), and will probably be a version behind in the 3.x series as well (I'm assuming your using 2.x given the PyGame requirement though).
Versions of PyGame seem to vary quite heavily between distros as well.
I'm trying to write an application that should work both on Windows 98 and XP. I decided to go with Python, but I'm having trouble even installing it on Win'98 (Python 2.7 installer says something about missing features of Windows Installer, but AFAIK 2.0 is the latest Windows Installer version compatible with '98).
Does anyone have a working Windows 98 environment with Python and wxPython? How did you make it work? I don't need Python 2.7, but a 2.4 or 2.5 would be nice.
If not, what other high-level language would you suggest that is actively maintained, can display Windows widgets and works with Windows 98? (asm/C/C++ and other low-level languages are out of question -- this is a simple application whose main job is to display windows and dialogs).
I'm pretty sure we used Python2.4 and wxPython on '98 way back when.
I don't have a win98 machine to test it on, but it looks like at least Python2.5.4 binaries are available for win98
I think win98 support may have been dropped for 2.6
wxPython download page says this
Microsoft Windows
The Win32 version of wxPython is
distributed as a set of standard
self-installing executables. This
allows you the convenience of using
the Start Menu and Add/Remove Programs
just like any other Windows software.
There are two versions of wxPython for
each of the supported Python versions
on Win32. They are nearly identical,
except one of them has been compiled
with support for the Unicode version
of the platform APIs. Unless you've
been told differently, you probably
want to get the Unicode build of
wxPython. Although they are not
nativly Unicode like NT-based systems,
the Unicode build of wxPython will
also mostly work on Windows 98/Me
systems using a Microsoft hack called
MSLU (or unicows.dll) that translates
unicode API calls to ansi API calls.
However the coverage of the API is not
complete so there are some difficult
bugs lurking in there, so the best
thing to do is to upgrade your
machines if possible, otherwise
Windows 98/Me users may want to try
the ANSI build instead.
and they are still release installers for Python2.5
Yes, Python droped Win9x/NT support at version 2.5.4.
However there are alternates builds: http://www.msfn.org/board/topic/162317-python-27-for-windows-95/
How do I get python to work with aptana studio?
I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE?
It's easier than you think. First, there's a version of python on your machine by default. It's kind of out of date, though.
MacPorts is a nice method to get lots of good stuff.
ActiveState has a Python Mac package downloadable for free.
Python.org will lead you to some other options as well.
To add the current Python version on Mac:
Add new interpreter via Aptana Studio 3/Preferences/PyDev/Interpreter-Python.
Give it name (check version using the Terminal and then python or /usr/bin/python.
Then add the path (2.7 in my case): /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
If you install your own (2.6 in my case) use the following path instead:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Don't forget to hit the "Apply" button...
Idle has a complete text editor -- open a "new window" and type away. Be sure to save it before you run it.
What didn't you like about the IDLE editor?
Also, look at Komodo Edit for Mac OS X. Very nice.
For windows, I'd recommend the aforementioned ActivePython. Mainly because it comes with Python win32, which you're going to end up installing anyway.
Secondly, if you're coming from the world of Java and C#, you might be expecting too much out of your IDE. I eventually found that more powerful IDEs just made things more difficult than they helped. So my advice is to try to go with something simple. In other words, go with something that will let you jump in and start coding rather than bugging you with a lot of features you probably won't need anyway. :-)
EDIT: One other thing, find and install pip. It makes installing python packages so much easier.
A lot of the sites in the Windows list mirror the Mac list.
Python.org has Win32 and Win64 installers.
ActiveState has a free Python Win32 package downloadable for free. There is no Win64 version (yet?).
PyWin32 is a Python package with extra modules for interfacing with Windows. This is not Python itself. These haven't been updated for Python 3.0, though. Despite the name, there is a Win64 version for Python 2.6 on this site.
On Mac OS X Leopard and Tiger, Python is already installed.
On Mac, I've tried a few editor. Textmate is my current choice. If you're looking for a free one, I really liked Xcode. But you'll have to run your script from the command line.
If you want a cross-platform environment, you could try Eclipse and the pydev extension. So you don't get lost between the two platform.
For Windows Operating system,
If you want to work with python using Aptana Studio. You have to do some simple basic settings with the interpreter.
For detailed step by step guide. You can follow this website link
http://www.infoknol.com/aptana-python-setup-guide/