After hours of research I have broken down to posting. I am trying to use the Pexpect module with python 3, which I am led to believe is possible from the document page which does say it will run with python 3.2.
Things I have tried: I have tried many different ways of installing including downloading the source and running the command sudo python3 setup.py install. I have also tried installing it with pip and *easy_install* which is what the documentation suggest. It seems that everything goes off with out a hitch until I attempt to import the module in the pyshell. When I type import pexpect I get the error:
class spawn(object):
File "/usr/local/lib/python3.2/dist-packages/pexpect/init.py", line 286, in spawn
write_to_stdout = sys.stdout.buffer.write
AttributeError: 'PseudoFile' object has no attribute 'buffer'
I have also tried googleing the error with no luck. And I have tried using python 2.7 and it works fine. I have tried on multiple debian based operating systems: Ubuntu 12.04 and Kali with the same results.
I feel like there is something obvious I am missing, but I just don't see it. Any points in the right direction Or helping me understand the error message would be much appreciated!
There was a bug in Pexpect 3.0 which stopped it working if sys.stdout was replaced before it was imported. It looks like IDLE replaces stdout, so as you've found, it doesn't work in IDLE & Python 3.
The bug has now been fixed. I'll try to get a new version of Pexpect out in the next few days, and then you'll be able to use it from IDLE.
Related
I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, which has an older python version, it gives me the following error:
Does anyone know how to fix this error?
I tried to install dotenv via pip manually, but it doesn't work.
I think you should use Pylaucher, to start Pylaucher you must Use Shebang (#) in The Script Run Pylauncher Command. Then you will be able to run multiple versions of python in Windows without getting errors. There are too many methods you can use; I strongly suggest this one since has once worked for me.
Windows 10, Python 3.8.5, using Mu 1.0.3. I am trying to install new modules. I just started learning python this weekend so I am pretty clueless. There does not seem to be much online that addresses this problem, unless I just don't know the right words.
I have tried going to command line and entering set PYTHONPATH="[a list of all paths that came up in response to printing sys.path]". The command line seemed to accept this, since it did not give me an error message. But Mu still gives me a
ModuleNotFoundError: no module named "modulename".
I have additionally obtained just the location of the module by typing its name into the shell, and then attempting sys.path.append("path"), in both Mu and the shell. I get the same ModuleNotFoundError.
So, how do I get the code editor to find modules? And, how do I make it a permanent fix?
As per this article the Mu editor has its own Python environment, separate from the one that typical Python installations have
Due to this, to be able to use them on Windows, we have to install our requirements into a specific location:
pip install –r automate-win-requirements.txt --target "C:\Users\USERNAME\AppData\Local\Mu\pkgs"
Being a complete begginer in python, I decided to install the python interpreter 3.4.4, and also PyDev plugin for eclipse IDE. I am also using windows 10.
I have encountered a problem regarding certain imports, namely : from PIL import Image, ImageTk, which is apparently an unresolved import.
I have looked at certain questions which were similar to my situation, but most of them gave a solution like installing packaged from the linux apt-get. Here are some topics I visited :
Uninstalling and reinstalling Pillow and pip,
Installing pillow-imaging-tk on Ubuntu,
This topic which left me very confused,
This one seemed helpful, but is on Unix OS again
So please, could someone explain to me why I am seeing this error, and how could I correct it if I absolutely want to use Eclipse, Pydev, windows 10 and Python 3.
Found the solution, here's what I did:
Set the PYTHONPATH like it is shown in this article, make sure python.exe is accessible via cmd,
Via cmd, type pip install pillow. Alternatively, you can enter the same command from Windows+R,
(Not sure if relevant step) Via eclipse, Windows->Preferences->PyDev->PythonInterpreterremove your interpreter to re-add it,
Restart eclipse.
For Python import problems in PyDev, the project web site has a page on interpreter configuration that is a good place to start. I recently had a similar problem that I solved by adding a module to the forced builtins tab.
I've installed mesos 0.26 successfully on a vm machine.
The installation has been performed on an ubuntu trusty thar system
by following this manual:
https://open.mesosphere.com/getting-started/install/
So far so good. I wanted to write a tiny python framwork.
For this I need to install the eggs via easy_install:
(I've downloaded the eggs accordingly for the trusty thar ubuntu and the 0.26 mesos):
wget http://downloads.mesosphere.io/master/ubuntu/14.04/mesos-0.26.0-py2.7-linux-x86_64.egg
easy_install mesos-0.26.0-py2.7-linux-x86_64.egg
all went fine, however, if I start python in the shell
and type in
import mesos.interface
I get the message: ImportError: No module named interface
As someone suggested, it may be that there is no longer a binding for python, or that they have renamed the API calls. Well, I looked in the version updates here:
http://mesos.apache.org/documentation/latest/upgrades/
Since the transition from 0.19.x to 0.20.x there hasn't been any changes regarding the mesos.interface part, or at least they are not mentioning it here.
To increase the confusion I also get the following error message when I'm typing in python: import mesos.native
There I receive: ImportError: No module named interface.mesos_pb2. To put it into a nutshell: what is going wrong here, and how can it be fixed? And yes, I've googled various web pages, with terms such as "mesos python bindings", mesos +api +python, etc. And yes, I have also consulted the official mesos webpage. There are nice refences for Java and C++ but not for python, or at least they are very well hidden.
Thanks in advance for any hints.
Solved. For what reasons ever:
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7/site-packages/
is required to set the PYTHONPATH. After that step it works like a charm.
Having some problems with Gdal installation with python 2.7 on Windows 7 32bit. I am running MSVC 2010. I have followed the instruction from the blog website
http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/
The installation is fine. At the end of it, I am able to run ogr2ogr in the MS-DOS and have gotten the similar screen as listed in the blog.
However, when I am trying to use the command "import osgeo" on the Python IDLE GUI shell. A series of error message is released, reading like the following
"DLL error:.........."
I believe that this might mean that the python binding is of wrong version. I have cleared up my installation by removing the following: Python-Gdal binding, Gdal, Python 2.7
After removing them, I have retried my installation with Python 3.2.3 instead and loaded the Gdal package and python binding accordingly. However, the same error returns.
Is there any intermediate steps that I could take to verify the installation. Any other advice I could have to have the bindings installed? Or is my reinstallation method correct?
I have tried to install FWTools too. It doesnt seem to work either. I have run the Python shell from EV-shell and type in "import osgeo". Have gotten the message "no module exist...."
Thanks
Get the precompiled gdal from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
I have some other notes on setting up postgres and postgis 2.0 here if you need it:
http://monkut.webfactional.com/blog/archive/2012/5/2/using-django-14-with-gdal-19-and-postgis-20/