3 answers

Replace true false null from dictionary

I want to replace 'true', 'false' and 'null' string with 'True', 'False' and 'Null' respectively from dictionary. Here is my dictionary { 'Ack': 'Success', 'Timestamp': '2015-09-02T13: 08: ...

1 answer

How to read a part of amazon s3 key, assuming that “multipart upload complete” is yet to happen for that key?

I'm working on aws S3 multipart upload, And I am facing following issue. Basically I am uploading a file chunk by chunk to s3, And during the time if any write happens to the file locally, I would ...

10 answers

Flatten nested Python dictionaries, compressing keys

Suppose you have a dictionary like: {'a': 1, 'c': {'a': 2, 'b': {'x': 5, 'y' : 10}}, 'd': [1, 2, 3]} How would you go about flattening that into something like: {'a': 1, ...

10 answers | 1 min ago by A Timmes on Stack Overflow stackoverflow.com
1 answer

NameError when calling a method

I have two files : One contains all my functions funclib.py import os from selenium import webdriver from selenium.webdriver.firefox.webdriver import WebDriver from ...

1 answers | 1 min ago by remya thomas on Stack Overflow stackoverflow.com
1 answer

Parse huge file shell ( or other scripting language )

I am trying to parse a huge file ( arround 13 GB ) and transpose it in a csv ( can also transpose it in two or three ). The file has the records on one line that is why it has arround 500.000.000 ...

0 answers

Split words from not formatted strings

I have an input of strings.For example, some of them looks like "Hellothis isexample". Does Python have any libraries that split strings like this into a single words? I want to get after all ...

1 answer

Python sub process for scripts

I want to execute two scripts in python. Script 1: Does dumping of data. Script 2: Does get status function. Script 2 should run while script 1 is dumping the data. How can I implement this via ...

1 answers | 4 mins ago by Abhishek Sharma on Stack Overflow stackoverflow.com
0 answers

VMWare with mounted drive: The executable venv/bin/python could not be run: [Errno 13] Permission denied when creating virtualenv on Ubuntu

When I run virtualenv venv it copies venv/bin/python but it has permission 600. I am running ubuntu on VMWARE player. The install of virtualenv went well. umask is set to 0002 Any tips on what ...

1 answer

Scrapy Spider keeps getting blocked

I'm trying to scrape https://www.etsy.com/ but my spider keeps getting blocked. Etsy supposedly has more than 23 million products but the maximum ammount of items I've managed to get is 120. Spider ...

1 answers | 5 mins ago by mud on Stack Overflow stackoverflow.com
1 answer

How to get the file count for each revision of mercurial using python script

import sys import hglib import re # figure out what repo path to use if len(sys.argv) > 1: repo1 = sys.argv[1] # connect to hg client1 = hglib.open(repo1) for data1 in ...

0 answers

Keeping the color scaling the same for different plots - Python

I am working with Python and matplotlib. I am doing a continuously plot of some data I get from a spectrum analyser. So with every new step of my loop a new piece is added to my plot. But i just ...

2 answers

Can I reverse my transformation of an XML file and get back the original?

Suppose I have a abc.xml and a sample.xsl which transforms my abc.xml to 123.xml. Now given the transformed XML and the stylesheet sample.xsl is there a way to get back my original abc.xml file. Is ...

2 answers | 9 mins ago by Bose on Stack Overflow stackoverflow.com
0 answers

How can I use a different color for each side of a polygon?

I want to draw an open polygon with say 50 sides. Now I am looking for a way to have each side a different color, depending on an index, eg: polygon_coordinates = [ [5, 10], [7, 9], [8, 11], [11, 20] ...

1 answer

pip requirements.txt github repo django app

I have forked a repo on Github in order to make my own changes to it. I have submitted a pull request to the original repo, but while I wait, I would like to add my repo to my pip requirements.txt. ...

1 answer

(the first 10-digit prime in e).com python google challenge 2004

I just come up to one of challenges that claimed to be used by google 2004 (the first 10-digit prime in e).com independent from that, I wanted to take the challenge and solve it with python ...

1 answers | 13 mins ago by ElTero on Stack Overflow stackoverflow.com
1 answer

Why does hglib not allow status for a revision and changes?

To get a list of changes, this answer gives the command line: hg status --change REV But calling status using hglib gives an error: >>> client.status(rev=-1, change=True) Traceback (most ...

1 answers | 13 mins ago by Peter Wood on Stack Overflow stackoverflow.com
8 answers

string count with overlapping occurrences

What's the best way to count the number of occurrences of a given string, including overlap in python? is it the most obvious way: def function(string, str_to_search_for): count = 0 for x ...

8 answers | 14 mins ago by calccrypto on Stack Overflow stackoverflow.com
1 answer

'dict' object has no attribute 'viewitems'

I want to apply below set operations on my python dictionary, in python 2.6.9 union = dict(set.union(*(set(service_configs[d].iteritems()) for d in service_configs if ...

1 answers | 15 mins ago by Pavan Gupta on Stack Overflow stackoverflow.com
0 answers

Plotting data set with extra points using matplotlib

I have searched stackoverflow to find an answer to my issue, but to no avail. I wish to plot an earthquake data set with a yellow star to represent the center of my study area. However, I can only ...

0 answers

how to remove specifc tags in xml using python

I have to remove some specific tag in apache-tomcat web.xml files web.xml <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" ...

2 answers

Python intersection of 2 UNICODE tuple/List

I am trying to search words from a file and appending resulting words from each line to a Tuple. And then I want to find intersecting words from the two tuples list_1 and list_2. But i get error- ...

1 answer

How to enable caching for Selenium's webdriver Firefox?

Every time I runwebdriver.Firefox.get('someurl)code, A new Firefox driver is shown and it doesn't cache any webpage that it loads. I want to make Selenium to tell every Firefox that get loaded to ...

1 answers | 21 mins ago by The_Diver on Stack Overflow stackoverflow.com
0 answers

Youtube API V3 returns an error when updating a video

I get the following error when I try to update one of my videos on YouTube using the Python library : { "error": { "errors": [ { "domain": "youtube.video", "reason": "forbidden", ...

0 answers

Pushbullet: No notifications in official Chrome extension when pushing via API

The official Chrome extension isn't behaving as I'd expect (and is not what how it behaved before). I've uninstalled and reinstalled it from Chrome store before doing this. Using the randomchars ...

0 answers

Python import statement inside and outside a function. What is better for the memory?

When memory issues are critical, do I save some memory when I do my python imports inside a function, so as to when the call finishes everything will be discarder from memory? Or this cumbers more my ...

4 answers

How to get the index of a maximum element in a numpy array

I have a 2 dimensional NumPy array. I know how to get the maximum values over axes: >>> a = array([[1,2,3],[4,3,1]]) >>> amax(a,axis=0) array([4, 3, 3]) How can I get the indices ...

4 answers | 25 mins ago by Peter Smit on Stack Overflow stackoverflow.com
4 answers

Python - difference between time

Looking for easiest way to calculate the difference between 2 python times and display the millisecond delta I have 2 times startTime = datetime.datetime.now().time() do some stuff... endTime= ...

4 answers | 26 mins ago by Stiley on Stack Overflow stackoverflow.com
1 answer

Pandas describe() behaviour for numeric dtypes

The output of the function DataFrame.describe() depends on the datatype. When used on a numeric dtype, it will return the following output: f.ID.describe() count 7583.000000 mean ...

1 answers | 29 mins ago by Kristof on Stack Overflow stackoverflow.com
1 answer

Having difficulties understanding Python's logger propagation

In the logging.json file defining the configuration of my loggers I defined a logger script_logger with a handler console set to output every logging messages to stdout. It has "propagate": "no" ...

1 answers | 29 mins ago by jul on Stack Overflow stackoverflow.com
1 answer

'pip' object expected error: 800a138f

I'm having some trouble with the 'pip' command in my command tool (Windows). I was hoping to play around with the Wagtail CMS, but upon trying the 'pip install wagtail' this error popped up: Script: ...

1 answers | 33 mins ago by Anthony Collins on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3