Error while installing robotframework -ride
I'm new to Python and have been trying to install some packages with pip.
I have gone through this sequence-------------
Download Python 2.7.15 from
https://www.python.org/downloads/ PATH = C:C:\Python27;C:\Python27\Scripts (Is this we have to set in User Variable or System Variable?)
Then download wxPython from this link (Download this version wxPython2.8-win64-unicode-188.8.131.52-py27)
Download setuptools (setuptools-39.2.0.zip) for Python from
Download PIP files (pip-10.0.1.tar.gz) from
Now Extract the Setuptools
After extracting from the same folder TYPE "cmd" it will open then run this commend
"python setup.py install"
Now Extract the PIP files
After extracting from the same folder TYPE "cmd" it will open then run this commend
"pip install robotframework"
On the cmd run these commends one-by-one
pip install robotframework-ride pip install robotframework-selenium2library pip install selenium pip install decorator pip install docutils pip install xlrd pip install xlwt pip install xlutils pip install pigments
But pip install robotframework-ride unroll gives me
D:\Python\pip-10.0.1\pip-10.0.1>pip install robotframework-ride Collecting robotframework-ride Using cached https://files.pythonhosted.org/packages/3c/14/a5f97f5cf5e981f01e8 c0b4c405b0dfc9bc86500cabb044d2c462f73004a/robotframework-ride-184.108.40.206.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\Deeksha\AppData\Local\Temp\pip-install-f5wsnk57\robotframew ork-ride\setup.py", line 20, in <module> execfile(join(ROOT_DIR, 'src', 'robotide', 'version.py')) NameError: name 'execfile' is not defined ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\Deeksha\ AppData\Local\Temp\pip-install-f5wsnk57\robotframework-ride\
How can I solve this?
See also questions close to this topic
Python Kafka Streaming API - Binning
I am using python kafka stream binning example given in this, Python Kafka Streaming API
I am able to generate the data using generator.py file given under winton-kafka-streams/examples/binning/, whereas when i run the binning.py file from the same folder, i got the below issue. Could someone help me, to resolve this?
Change color of missing values in Seaborn heatmap
Consider the example of missing values in the Seaborn documentation:
corr = np.corrcoef(np.random.randn(10, 200)) mask = np.zeros_like(corr) mask[np.triu_indices_from(mask)] = True sns.heatmap(corr, mask=mask, vmax=.3, square=True)
How do I change the color of the missing values to, for example, black? The color of the missing values should be specified independent of the color scheme of the heatmap, it may not be present in the color scheme.
I tried adding
facecolor = 'black'but that didn't work. The color can be affected by e.g.
sns.axes_style("white")but it isn't clear to me how that can be used to set an arbitrary color.
Xpath + Scrapy + Python : data point couldn't be scraped
This is the XML structure:
<tr> <td> <font size="3"> <strong>Location:</strong> Hiranandani Gardens, Powai </font> </td> </tr>
I want to extract : Hiranandani Gardens, Powai
I tried with these:
Both returned an empty list.
Note: we must have to use the text of tag, i.e., "Location:". Otherwise, there are many other places on the site where the same XML structure is used. So, it'll fetch many more unnecessary things apart from the desired value if the text of strong tag is not used.
Python if-elif-else runtime optimization
I did a search on the previous asked question, but without finding what i need to optimize my code.
For info, I am running on Python 2.7 but could change to 3 if needed
I am converting every pixel of an image and because of some condition i have to do it pixel by pixel. So i have nested for loop with an if-elif-else statement inside, and it takes an awful long time to run. For an image of 1536 x 2640, the whole code takes ~20 seconds and 90% of time is inside this double for loop
I believe there should be a better way to write the below code
for pixel in range(width): for row in range(height): ADC = img_original[row, pixel] if ADC < 84: gain = gain1 offset = offset1 elif ADC > 153: gain = gain3 offset = offset3 else: gain = gain2 offset = offset2 Conv_ADC = int(min(max(ADC * gain + offset, 0),255)) img_conv[row, pixel] = Conv_ADC
Thanks for the help
edit for additional detail:
@Jean-FrançoisFabre is right and I am applying three different gain/offset depending on which section I am between 0 to 255. But the section are not always evenly space and can be modified. Maybe to give some additional context, i am simply applying a custom S-curve to an image to shift the pixel value up/down. And each column in the image have their own S-curve
my gain1,2,3/offset1,2,3 values are floating point. the gain will always be positive and the offset can be negative or positive.I also have an individual value for each pixel in the width direction, but they are common in the row direction.
Example, all pixel from column 1 with can use gain/offset 1,2,3 from the 1st row in table below. All pixel from column 2 in the image will use gain/offset form the row 2 in the table below
Pixel G1 O1 G2 O2 G3 O3 1 0.417722 24.911392 0.623188 7.652176 1.175676 -76.878357 2 0.43038 25.848103 0.623188 9.652176 1.148649 -70.743225 3 0.443038 23.784809 0.637681 7.434776 1.175676 -74.878357 4 0.443038 22.784809 0.652174 5.217384 1.175676 -74.878357 5 0.455696 23.721519 0.637681 8.434776 1.202703 -78.013519 6 0.455696 21.721519 0.637681 6.434776 1.243243 -86.216217 7 0.455696 22.721519 0.623188 8.652176 1.216216 -82.081085 8 0.443038 22.784809 0.623188 7.652176 1.22973 -85.148651 ... until pixel 2640 in width direction
I will look at @Jean-FrançoisFabre solution, but in the meantime i was also looking at using some numpy approaches.
Once i get something that compute faster, i'll post my finding here
Python generate XML File with printing all possibility for the Element
I try to programming in Python a Script, which is generate automaticly a XML File whith some information in there.
So i am stuck on a Point. I have 6 subelements. The text of a subelement can be a 0 or a 1. I want print all possibility for the 6 Elements.
What I have:
listTCPFlag["fin","syn","rst","psh","ack","urg"] lustTCPFlagAnswer = [0,1] listProtocol = ['TCP','UDP','ICMP'] top = Element('Test') ipHeader = SubElement(top, 'IpHeader') ipProtocol = SubElement(ipHeader,'protocol') for x in range(len(listProtocol)): ipProtocol.text = str(listProtocol[x]) if(ipProtocol.txt == "TCP"): tcpHeader = SubElement(top, "tcpHeader") tcpPort = SubElement(tcpHeader,"destPort") tcpFlag = SubElement(tcpHeader, "flag") tcpFlagFin = SubElement(tcpFlag, "fin") tcpFlagSyn = SubElement(tcpFlag, "syn") tcpFlagRst = SubElement(tcpFlag, "rst") tcpFlagPsh = SubElement(tcpFlag, "psh") tcpFlagAck = SubElement(tcpFlag, "ack") tcpFlagUrg = SubElement(tcpFlag, "urg") # I tried to implement this in a for loop: for z in range(len(listTCPFlag)): for u in range(len(listTCPFlagAnswer)): if(listTCPFlag[z] == "fin"): tcpFlagFin.text = str(listTCPFlagAnswer[u]) # ...
After careful consideration and testing, I found that the loop is wrong.. And now I am in a thoughts gap and don't know how I can fix this problem.. My output should be like:
<root> <element_1> 0 </element_1> <element_2> 0 </element_2> <element_3> 0 </element_3> <element_4> 0 </element_4> <element_5> 0 </element_5> <element_6> 0 </element_6> </root>
<root> <element_1> 1 </element_1> <element_2> 0 </element_2> <element_3> 0 </element_3> <element_4> 0 </element_4> <element_5> 0 </element_5> <element_6> 0 </element_6> </root>
<root> <element_1> 0 </element_1> <element_2> 1 </element_2> <element_3> 0 </element_3> <element_4> 0 </element_4> <element_5> 0 </element_5> <element_6> 0 </element_6> </root>
<root> <element_1> 1 </element_1> <element_2> 1 </element_2> <element_3> 1 </element_3> <element_4> 1 </element_4> <element_5> 1 </element_5> <element_6> 1 </element_6> </root>
After that i try it with a "add_binary_nums(x,y)" function. Like this: https://www.w3resource.com/python-exercises/challenges/1/python-challenges-1-exercise-31.php
For my Opinion I prefere a for-loop which can handle with that. But I have no Idea how it could be build. How can i do it in a simply way in Python 2 and in a For - loop ?
How to check if two different strings from two different files are present in third file?
I want to check if two different strings which are from two different files are present in third file and if they are present then write that line to fourth file. The set of strings are IPv4 addresses. I am getting empty file even if the strings are present in both files. Also I want to implement multi-threading/multiprocessing to speed up the process if possible. Thank you so much for any suggestion/help in advance.
slave_list text file has entry as below:
hostA 192.168.15.32 hostB 192.168.15.33 hostC 192.168.15.37
static_ip_list text file has entry as below:
192.168.100.10 192.168.100.12 192.168.100.14
slave_logfile has entry as below:
1536043051.176 59320 192.168.100.10 TCP_MISS/200 21830 CONNECT www.google.com:443 - 192.168.15.32
from datetime import datetime, timedelta import os import string import sys slave_list = sys.argv static_ip_list = sys.argv append_log = open('/home/top10_domain_accessed/logs/append_logs.txt', 'a') def file_path (slave_list): count = 1 while(count <=30): Nth_days = datetime.now() - timedelta(days=count) date = Nth_days.strftime("%Y%m%d") yr_month = Nth_days.strftime("%Y/%m") file_name = 'local2' + '.' + date with open(slave_list) as file: for line in file: string = line.split() slave_name = string slave_ip = string log_path = "/LOGS/%s/%s" %(slave_name, yr_month) slave_logfile = os.path.join(log_path, file_name) if os.path.exists(slave_logfile): log_read = open(slave_logfile, 'r') for line in log_read: if slave_ip in line: with open(static_ip_list) as ip_list: for static_ip in ip_list: static_ip = static_ip.rstrip() if static_ip in line: append_log.write(line + '\n') else: pass count = count + 1 if __name__ == '__main__': file_path(slave_list)
pip3 install error when I use virtulenv as general user
I found the following problem when I tried to install the package using the
pip3command in a virtual environment.
source /bin/activate ##activate virtualenv pip3 install aiohttp ##
error: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/yxs/venv/py34/lib64/python3.4/site-packages/multidict' Consider using the
--useroption or check the permissions.
pip3 install --user aiohttp
error: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
So, I tried
sudo pip3 install aiohttp，When I checked with
pip3 list, I found that aiohttp was installed in the system. Beacause
(py34) [yxs@yxs ~]$pip3 list ## no package named aiohttp [yxs@yxs ~]$pip3 list ## found aiohttp
How can I install packages into virtualenv?
The operating system is CentOS7.5, the default Python version is 2.7, I installed python3.4 through epel-realse, pip3 installed by get-pip.py.
I guess the problem is that I have to use command
sudoto install, but this command will leave the virtualenv environment. Just like the following, but I don't know how to solve this problem. By the way, these operations are excuted in the tmux session.
(py34) [yxs@yxs ~]$su - root
Last login: Wed Sep 19 12:07:23 CST 2018 on pts/2
All in all, I can only use root to install the package into virtualenv by command
Uninstall all the packages installed using pip by a user on macOS High Sierra
By mistake I installed packages in the global environment using pip. I was wondering if its a good idea to uninstall the already existing Python on the OS using the instructions provided here, and re-install it using homebrew using the instructions provided over here? Or is there any way to get rid of all packages and their dependency I installed using pip.
I'm using Python 2.7.10 on macOS High Sierra. EDIT: Problem with a suggested approach:
As suggested by CloC in the comments section, I tried uninstalling all packages from global environment by typing
pip freeze > to_delete.txt
sudo -H pip uninstall -y -r to_delete.txt
However I got the following error in the terminal:
Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/basecommand.py", line 141, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/commands/uninstall.py", line 74, in run auto_confirm=options.yes, verbose=self.verbosity > 0, File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/req/req_install.py", line 864, in uninstall uninstalled_pathset.remove(auto_confirm, verbose) File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/req/req_uninstall.py", line 221, in remove renames(path, new_path) File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/utils/misc.py", line 276, in renames shutil.move(old, new) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move copytree(src, real_dst, symlinks=True) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree raise Error, errors Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py', '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py'"), [...], "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib'")]
(pip install virtualenvwrapper-powershell SyntaxError: invalid syntax
while installing , i got below error SyntaxError: invalid syntax ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\vinok\AppData\Local\Temp\pip-install-61ch4ssy\virtualenvwrapper-powershell\