Tag Info

New answers tagged

0

@bumy's fix worked for me ... but I was annoyed that despite having python3-pip installed on my newly installed Fedora 22, /usr/bin/pip3 wasn't present. So I copied /usr/bin/pip (the Python2.7 version) to /usr/bin/pip3 and modified the first line to be #!/usr/bin/python3 Now I can use pip3 as god intended ...


0

After resetting Windows and reinstalling Python, the problem disappeared. However, after I reinstalled IPython and PyReadline the problem reemerged. Uninstalling PyReadline resolved all of my original problems, but I want to know if anyone else encountered a similar problem with different modules. Regardless, I will keep track of any other modules which ...


0

In the past, when I was doing this from windows platform to any other system that supports a sshd or sftp, I used WinSCP which has very well written sync features. WinSCP can also be executed from the command line to watch a local directory and automatically push and/or pull files to a remote file system via SCP or SFTP protocols. The WinSCP solution is ...


0

First, thank you very very much for this command because it solved to me a problem. Answering your question, you can make the iteration only 1, so the bash code will cancel in one iteration and then you can get the output using ">file.txt". And you can put all this code in a loop with 500 iterations or what you want.


0

Anything to do with time you are better off putting in the script. import time start = datetime.date.today() <doing something> end = datetime.date.today() runtime=end - start output values to a log or database. Connect to your logging server over a secured connection like https making sure it is using TLS 1+ instead of SSL. Databases make ...


0

Things are quite easy with a good regular expression utility. Certainly python can handle this, but JREPL.BAT can provide an even simpler solution. It is a pure script based utility (hybrid JScript/batch) that runs natively on any Windows machine. Simply copy the script into a folder that is listed within your PATH. I'm assuming each file name is <= 8 ...


0

when you run which python and which pip what do you get? chances are they will be symlinks to other executables in /usr/bin/. If you update your symlinks or run python directly (ex /usr/bin/python2.7), you can have both version installed side by side. I would definitely recommend using python virtual environments in the future and avoid mucking with your ...


0

You can consider the following piece of code, just a simple demo, did not handle any possible error. with open('test.txt', 'rb') as f1: with open('result.txt', 'a') as f2: for line in f1: if 'BA' not in line: cols = line.split() clip = line.split(':')[-1].split('.')[0].strip() if ...


0

Replacing parts of a line, using Python, under Windows How I long for a quick bash one-liner1. However, this script should do what you want by using a simple regex to extract the filename, then using that in the string.replace() function. Script: #!/usr/bin/env python3 import sys, fileinput, re if __name__ == "__main__" and len(sys.argv) > 1: rx = ...


0

In Python, you can use sklearn.feature_extraction.text.CountVectorizer.fit_transform: it learns the vocabulary dictionary and returns a term-document matrix. Example: import sklearn import sklearn.feature_extraction vectorizer = sklearn.feature_extraction.text.CountVectorizer(min_df=1) corpus = ['This is the first document.', 'This is the second ...


1

Using net use S: \\D-DWSQL01\Share\load Apparently allowed the schedule task to see the drive normally.


0

If you want to keep your 64-bit version of Python, at this moment, an easy to install and recent version of Vim64 for Windows can be found here. It even uninstalls your existing 32-bit gvim for you.


1

The "hashbang" as it is known is only useful when it appears at the beginning of a file. When a file is executed from a *nix shell that starts with those two bytes, the following pathname is called to interpret the remainder of the file. This allows interpreted scripts to be treated on the same level as compiled binary executables. The shell passes the ...


0

It is called shebang. Interpreters ignore it as the line begins with '#' and it means it's a comment, but for the system it tells what to do with that code on execution. The path after the '#!' is the path of the interpreter, and if you run the code, it will open the file with the interpreter you gave in the shebang.


0

Found details for the builtin source in ss64's man pages. Unless you provide an exact path to filename then bash will look first via the PATH variable and then in the current directory (only if filename is not found in $PATH.) If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional ...


0

well i switched to centos7 and got my django1.8 working with below commands yum install gcc libffi-devel python-devel openssl-devel yum install python-devel yum group install "Development Tools" yum install python-pip pip install virtualenv pip install virtualenvwrapper pip install requests[security] cd /var/www/html/project1 virtualenv . pip install ...


0

I recommend installing virtualenv as a system package: apt-get install python-virtualenv In your case you're installing virtualenv with pip and then creating the virtualenv, which doesn't make so much sense to me as pip should be used once you have your virtualenv, so any installed package stays "local" to the virtualenv.


0

To run Windows Python from within Cygwin, always do this: $ cygstart python Never do this: $ python -i This extends to Windows IPython as well. Always do this: $ cygstart ipython Never do this: $ ipython -i Before we get to why, however, let's talk ${PATH}. Python and ${Path}: Together at Last! The above answer assumes the python in your ...


0

The problem is probably that nc is a two-way connection, but popen() only uses one way. When the remote server tries to read from the connection, nc will read from its stdin, which you are not setting, so it probably gets eof and so the connection closes. Instead of popen() use the bidirectional subprocess.Popen(). import subprocess cmd = "nc -v [MY IP] ...


0

It does, you just need to choose a two-line plot instead of a one-line plot.


4

When starting a script (as a command), it looks at the hash-bang (#!) to know what to use to start the script. In your script, I'm betting it starts with #!/usr/bin/python or similar. When you start it as ./script.py, it reads that first line and executes /usr/bin/python ./script.py secretly. If you prepend it by using bash ./script.py, it expects the ...


0

Nevermind matching everything except substrings beginning with '@' or '#'. I just did the opposite and used re.sub in python to remove those from the string: >>> import re >>> text = 'Hi shah rukh. Who is your co-actor in the upcoming movie? @iamsrk #lovefrommalaysia #askSRK' >>> text = re.sub(r'([\#\@].*?)(?=([\r\n ]|$))', '', ...


0

Composability is the king with Emacs, just combine M-i with https://github.com/magnars/multiple-cursors.el and you have your indent block command. That is you do: M-> N times (where N is the number of lines in block) M-i


0

Okay so Apache and Python are two very different things that can work together to host a web application. Apache is a web server, you make requests to it by browsing to that devices URI and the Apache web server does its thing and serves up a response based on the request it was sent. https://en.wikipedia.org/wiki/Web_server ...


1

I'm most fluent in Bash, but I'm sure you could do the same thing in Power Shell. I'm assuming that you are going to convert to .jpg format and store all the files in a ./output/ directory. My script would look like this: j=0; for i in `find . -type f \( -iname *.jpg -o -iname *.jpeg -o -iname *.png -o -iname *.gif -o -iname *.bmp \)` do j=$(($j+1)) ...


0

Debuild is what you should be using to install foreign software. The issue is that if you don't build and use a .deb package then apt-get, aptitude, synaptic, and the like aren't aware of the files you put into your file-system. This will cause issues, as you are now aware, with upgrade and removing those unknown files.


0

Start off by moving "/Library/Frameworks/Python.framework" to another location and see if it causes anything to break (presumably not). If you can't find anything depending on it, you can safely remove it, as it is not normally part of OS X. EDIT: After moving it, you should try to reinstall it through Brew



Top 50 recent answers are included