Tag Info

New answers tagged

0

In case of broadcast, you should not use TCP rather you should use UDP. Then again you need to use sendto() method instead of connect(). sendto() is used to send data to a certain address which is the "broadcast" address in our case. So the following should work: import socket message = "Hello" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ...


0

Very nice alternative to screen is program called tmux. I use it constantly for daily basis. Tip: To dump process into same terminal, runcd any command you'd like, then: Ctrl + Z - to stop process write bg - it will dump process to the background


1

import socket import subprocess ClientSocket = socket.socket() try: ClientSocket.connect(("remote_host", 22)) port = 22 except socket.error: ClientSocket.connect(("remote_host", 23)) port = 23 finally: command = "sshpass -ppassword ssh -t -t username@remote_host -p {0}".format(port).split() subprocess.call(command) ...


0

You could try to run your Python script with the nohup command infront. Nohup will make the script immume to hangups. example nohup python myscript.py & Your output will be send to nohup.out.


1

This stack overflow question may enlight your problem, just adapt the code to your needs. For example: import socket sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if sck.connect_ex(('some_host_name_or_ip', 23)) == 0: ## Telnet is open do telnet related stuff here sck.close() sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if ...


3

You need end of line anchor $ for you regex: import re a = re.search("^l.*op$",line).group(0) op$ Matches op from the end of the string or just before the newline at the end of the line.


1

I would again purge python-pip and install it differently wget https://bootstrap.pypa.io/get-pip.py Then sudo python get-pip.py And see if that works better for you. edit This route will get you newer than what in repo. You can also then update using pip install -U pip Not sure if you can do that if installed with apt-get.


0

Very simple: go to a terminal by pressing Ctrl+Alt+T and type the following commands: ufw enable apt-get install gufw The first command enables the gnu Firewall and the second command installs the GUI. Now just click on the dash and type firewall and then click on the sole remaining icon to open the GUI!


0

First you have to fulfill the requirements: git (sudo apt-get install git) clang (sudo apt-get install clang) c++ (sudo apt-get install build-essential) boost (sudo apt-get install libboost-all-dev)


5

The following python commands should give you the long description when available: $ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import apt >>> cache = apt.Cache() >>> pkg = cache['python2.7'] >>> pkg <Package: ...


1

I was able to resolve this issue by removing my matplotlib font cache (both the Python 3 and Python 2 font caches), e.g., rm /home/arthur/.cache/matplotlib/fontList*.cache I can now use any other following environment initializations without errors: ipython3 --pylab ipython3 --matplotlib tk ipython3 --matplotlib qt4


0

There is a function that does exactly what you ask, but would not work in the __init__ of your example, this function is called unselect_all, and belongs to Gtk.TreeSelection. So I took the riverbed to edit his example. Forgive English, is extracted from the Google translator. #!/usr/bin/python import os, stat from gi.repository import Gtk from ...


0

For this kind of situations, I suggest no password at all -- use ssh-keygen 1) generate a pair of authentication keys. Do not enter a passphrase: ssh-keygen -t rsa 2) append the new public key .ssh/id_rsa.pub to destination hosts .ssh/authorized_keys cat .ssh/id_rsa.pub | ssh cisco@host 'cat >> .ssh/authorized_keys' After that you can ssh ...


1

In the debian/install file, add this line (or only use this line, if there aren't any others in there): moduleFileName /usr/local/lib/python2.7/site-packages/ You basically use the same line format for each file (or directory): filename /path/to/destination/


0

Maybe for long action, you'll be lucky scanning regularly for instance the "ps ax" results, but no warranty for short actions... (and also won't work neither for the "selected this element", nor "clicked on this icon") What is your real need ? Is it a kind of spy ? or is it to replay some actions (like for regression tests) ? [then look at robots or ...


0

In Python3 print is a function: print(" hello world") Check: https://docs.python.org/release/3.4.0/whatsnew/3.0.html


1

Your line that constructs getRpm should probably be: getRpm = 'wget %s' %url Basically, just remove the extra double-quotes.


0

I recently updated from 4.0.1 to 4.0.4, which I had installed in /usr/local/bin/ (I'm new to Linux, so I'm not sure if this is the best location). Essentially I moved the tarball there, unpacked it, deleted the old directory, realized the script was still pointed at the old (now nonexistent) version, and edited the script to point at the new version. It ...


3

You can use pip3 (which is just normal pip but in system's Python3 packages). Normally I would suggest avoiding using pip for installing stuff globally but given there are no packages for this that could overwrite the files, there's nothing to lose. It's quick and simple: sudo apt-get install python3-pip sudo pip3 install sympy


1

The package distribute 0.7.3 is a deprecated fork of Setuptools, install it only if you can't install Setuptools and need a compatibility layer. Before anything, execute in a terminal (xterm or Terminal are both fine) sudo apt-get install python-setuptools to install the distribution version of setuptools. If you really need to proceed, follow this ...


0

Most likely you still have the wrong hashlib (the one without openssl_md_meth_names) hanging around. It is being imported instead of the proper one. Do this as a root: # cd / # find . | grep hashlib Then remove (ok, rename ;-) ) any hashlib files not in /usr/lib/python2.7


1

I found a way to uninstall it clearly. Just found the .tar file again and make install it again, it will output what it is installing. And just delete all the files and folder shows in there.


1

Along with the other answers you can also use the full path to the executable. For example, if your python executable is in /home/user/some_dir/python then running the following command from in the terminal will do the job: user@user-home:~$ /home/user/some_dir/python For ease of use you can create an alias for the above command so that you don't have to ...


0

I solved my problem. I added an alias to ~/.bashrc as follows: alias python=/usr/local/python I found the path I was looking for by going to Python IDLE and doing the following: import sys sys.path This returned the location of the python version IDLE uses. I searched around a bit and found the path I was looking for!


6

Specify the path. If you're in the directory with the binary, that's as simple as: ./python Or yes, do as Muru suggested and add it to the path. That said, changing the path could interfere with how applications (running under your user) call Python. If you deflect them to the wrong version, they may function incorrectly. There is not a good way to ...


1

conda is a package management tool for installing scientific and analytical computing packages, which may be written in Python or other programming languages. conda also creates a virtual environment, like python-virtualenv does. conda is the package manager of Anaconda. Anaconda is a free Python distribution provided by Continuum Analytics, which includes ...


7

You are forgetting to supply a mandatory argument. Usage: eui_install.py [ZIPFILE] means you have to include a name of a zipfile. The command is: python eui_install.py zipfile where zipfile is a file name you need to supply (probably the mod you want to edit looking at the script). The files in the designated folder still have names with ...


0

For Ubuntu 13.10 and later versions, you need to install OpenOffice 4.1.1 manually. Remove the previous version: sudo apt-get remove libreoffice* openoffice* sudo apt-get autoremove Installation Apache OpenOffice 4.1.1 on 64-bit Ubuntu: wget ...


0

Finally, I considered installing iPython Notebook system-wide (outside a virtual environment). I had previously tried just install pyzmq system-wide but this wasn't enough. When I considered install iPython Notebook outside the virtual environment, I realized, "How do I get pip to discriminate between Python 2.7 and Python 3.4?" I went searching and found ...


1

Ubuntu comes with Python installed by default, you don't need install any .tgz file downloaded from http://python.org/download/ The library for access postgresql in Python called "psycopg" See: psycopg docs here: http://initd.org/psycopg/docs/ To install psycopg, you need to first install the build dependencies: Make the terminal: sudo apt-get install ...


2

gcalcli is using a Python library (parsedatetime) that is out of date in 14.04, I found the solution in this bug report: https://github.com/insanum/gcalcli/issues/132 So basically we need to upgrade python-parsedatetime, you can either do this with pip if this is your preferred method: sudo pip install --upgrade parsedatetime Or via Chris Johnson's ...


0

You may have an issue with your LD_LIBRARY_PATH or something of that sort, possibly replacing the correct libexpat.so with some other one (i.e., something in /usr/local such as the library installed with MATLAB). This post addresses this problem: http://ubuntuforums.org/showthread.php?t=2094005


1

Ubuntu 14.10 comes with Python 2.7.8 (available as python, python2 and python2.7) and Python 3.4.2 (available as python3 and python3.4) installed by default. As many programs depend on them you can't remove any of them without breaking your system.


1

From a fresh installation of 14.04, I had to install python-dev, libffi-dev, libssl-dev, libxml2-dev, and libxslt1-dev. Once those were installed, pip install scapy worked fine. sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev pip install scapy


4

Make sure your API endpoint URI is exactly as shown in the Landscape server. Typically it will end with /api/ (trailing slash included). And, of course, that the access keys are correct.


0

Are you actually using ~/api/key.pem ? You might need to throw in an os.path.expanduser around it, or otherwise provide the full path.


0

It's "installed" so the ~/Downloads/Python-2.7.9 directory is safe to delete. However, you can keep it somewhere you like as backup.


0

It looks like your dpkg-dev and gcc packages aren't up to date enough for the build process. Try: sudo apt-get update sudo apt-get install gcc4.9 sudo apt-get upgrade dpkg-dev And then do your backportpackage again to see if it's any better. As it looks like that build process is looking for gcc 4.9, thus the second command


1

After a few days of trial and error I found the answer to my question. I decided to post my solution to my question because it might help someone who is experiencing the same problem. Here are the steps that I followed. Open the terminal crt+alt+t Type gedit ~/.local/share/applications/mimeapps.list Under [Added Associations] list add ...


0

You need to use omnifunc to provide the completion. It will pop up a menu to allow for completion. More information here. In my .vimrc, I have the following lines set for Supertab: let g:SuperTabDefaultCompletionTypeDiscovery = [ \ "&completefunc:<c-x><c-u>", \ "&omnifunc:<c-x><c-o>", \ ] let g:SuperTabLongestHighlight = 1 ...


1

Found this on another site and it worked for me. Very simple solution! "I'm using Ubuntu 14.04.1 and needed to change the location of blender from the default of 'blender' to '/usr/bin/blender' since this is the path used to access blender. From a terminal screen type 'which blender' (omitting quotes) will display the path to the blender executable. Enter ...


0

This solution work for me on Ubuntu 14.04 as libjpeg was not available in the repository. What did end up working for me sudo apt-get build-dep python-imaging sudo apt-get install libjpeg62 libjpeg62-dev



Top 50 recent answers are included