-1
votes
1answer
29 views

Python not displaying correct output

Hey guys I'm having problem with this python question. A formula for computing Easter in the years 1982 – 2048, inclusive, is as follows: let a = year %19 b = year %4 c = year % 7d = (19a + 24)%30 ...
0
votes
4answers
36 views

Python can't receive correct output

Hey guys I'm having problem with this python question. A formula for computing Easter in the years 1982 – 2048, inclusive, is as follows: let a = year %19 b = year %4 c = year % 7 d = (19a + ...
4
votes
4answers
70 views

What is the most pythonic way to sort dates sequences?

I have a list of stings representing a month in a year (not sorted and not consecutive): ['1/2013', '7/2013', '2/2013', '3/2013', '4/2014', '12/2013', '10/2013', '11/2013', '1/2014', '2/2014'] I'm ...
0
votes
1answer
20 views

Installing Swampy for Python 2.7 Help Please

I've been trying to do this for 3 hours. I have windows. I'm using this official guide: So for step 2 for the windows installation for Python 2: it says: "To see if you have Tkinter, launch python; ...
0
votes
2answers
29 views

What is the equivalent to b'string' on a variable?

I need to encode a string of text before using it, but the only problem is it is a variable and all I know is that normally I would use b'string'. I assume I would use variable.encode(), but what ...
-4
votes
0answers
16 views

Python Turtle Cellphone [on hold]

Give three attributes of your cellphone object. Give three methods of your cellphone. http://interactivepython.org/courselib/static/thinkcspy/PythonTurtle/helloturtle.html I'm not for sure what they ...
1
vote
1answer
14 views

How to set breakpoints in a library module (pdb)

I am debugging a python script which sys.path looks like sys.path = ['','home/my_library', ..] I'm having troubles to set a breakpoint in a module from my_library while using pdb. The script ...
1
vote
2answers
31 views

Get list of Windows 8.1 processes using Python

I want to get the list of processes in memory including the name and the PID in Windows 8.1. Here's my code: import subprocess import os cmd = "WMIC PROCESS get Caption,ProcessId" proc = ...
2
votes
3answers
50 views

Python, sort a list by another list

I have a list a: a = ['c','d','b','a','e'] and a list b: b = ['a001','b002','c003','d004','e005'] and how could I get my list c as following: c = ['c003','d004','b002','a001','e005'] ...
0
votes
2answers
28 views

Python (2.7) script monitoring and notification system

I've read a lot of other posts about monitoring python scripts, but haven't been able to find anything like what I am hoping to do. Essentially, I have 2 desktops running Linux. Each computer has ...
0
votes
0answers
4 views

Regarding resizing a panel that contains an image as backgound in wxPython

I am working with python v2.7 and wxPython v3.0 on Windows 8 OS. In my app I have a scrolled panel with a background image. This panel is named as mainPanel in the code snippet. This ...
1
vote
2answers
28 views

How to read specific characters in python 2.7.6 in a specific line?

Suppose I have this text written in line number 5 " Name: Roger Federer how can I go to line number 5 first and then read and print out "Roger Federer" instead of the whole line.I am not getting ...
0
votes
2answers
42 views

how to solve ValueError in pyhton

I'm working for a image search engine application, I have the code in separate .py files and its working fine. But I want to optimize it. When I put the code under the function, its giving me ...
0
votes
0answers
12 views

Data Nitro and Fuzzy Logic

I am trying to do fuzzy logic on an Excel spreadsheet for two data sources exported from Microsoft CRM. One is Account data, and the other one is Lead's data. Account Sheet contains - All the ...
-1
votes
0answers
22 views

Django 1.6, django-allauth, multiple user types [on hold]

I am relatively new to Django, so please be patient with me. I am working on a site that requires two types of users - Customers and Businesses. Both user types have several things in common - name, ...
3
votes
1answer
70 views

Circular inheritance? What?

So I've been messing around in python and I don't understand what the shell is going on with this. I start by writing these classes in this order.. comments are my understanding of what's happening: ...
1
vote
1answer
49 views

how to run python with args in python code [on hold]

I'm trying to write a program in Python that scan files and then insert it into the command when i try to run "python submit.py path/arg" i get an error. i tried many commands without success ...
0
votes
2answers
12 views

Python logging messages appears in stdout when script is launched

I'm setting a logging feature in my test script, but when I run it all messages are appearing on the console(stdout), the log file is written ok, how can I avoid this behaviour? I only want the ...
0
votes
0answers
14 views

Import error in sqlalchemy in Ipython

I have gone through previous related questions and tried those solutions. I am trying to import sqlalchemy into Ipython. I have installed SQLAlchemy version 0.9.4 along with the extension ...
1
vote
1answer
18 views

numpy.memmap map to save file

I'm trying to create random matrix and save it in binary file using numpy.save Then I try to map this file using numpy.memmap, but it seems it maps it wrong. How to fix it? It seems it read .npy ...
2
votes
1answer
40 views

Compile Makefile from Linux on Mac OS

I am trying to port a Linux app (C++ and Python-based code) on Mac OS X 10.9.2 (later on Windows). The Linux version works pretty well and the command "make" build the necessary files in order to run ...
0
votes
0answers
13 views

Editing a python script with VB.net

I am facing a problem while importing the class in eclipse. I was using dSpace simulation environment, where for coding we used import <class_name>. But for eclipse we need to mention the ...
0
votes
0answers
12 views

Lowering process priority of multiprocessing.Pool on Windows

I use multiprocessing.Pool() to parallelize some heavy Pandas processing but find that it is a bit too successful. My CPU usage goes to 100% and my entire computer becomes very unresponsive. Even the ...
0
votes
6answers
55 views

How to merge item in list

I have problem with list in python. When I print "list" I have this results: [1,2,3] [4,5,6] So I have two lists in one variable I guess. How can I merge this items to one variable ?
0
votes
1answer
10 views

pyPdf.utils.PdfReadError: Unexpected escaped string

I've got PDFs 'monkeys' with drawings and I need to dynamically add measures on these. I've tried following this : Add text to Existing PDF using Python But I get the following error : Traceback ...
0
votes
2answers
38 views

check if it's File

I have written very small code to check if it's file. I was expecting I should get "yes" print but I did not get. Am I doing any silly mistake. os.listdir(os.getcwd()+"/../py") a = ['a.py', 'a.pyc'] ...
0
votes
0answers
11 views

Broken python imghdr library

The python imghdr library can be used to identify image files; in the case of JPEG images, it tests for exif/jfif markers ignoring the SOI marker at the start thus mis-identifying some jpeg images ...
0
votes
0answers
25 views

slicing the pandas data frame with month range

I am working on a dataset which has a years data on a pandas data frame. The sample is given below. The data is indexed on the Date column DATE 2013-12-07 6555 10171 2013-06-17 ...
0
votes
2answers
34 views

Python testing if whitespace(\s) symbol is in string

I have a problem testing if "\s" symbols are present in a string. For example is '\sgoogle\s.com' must show that there is.
1
vote
2answers
45 views

How to pass variables between methods in the same class in Python

I don't think I'm using class variables correctly. Inside the ClientFormPage class, I initialize the active_form to 'f1_form'. After I post the first form, I'd like to advance the active_form to ...
0
votes
0answers
33 views

Am I using threading correctly in Python? [on hold]

I'm learning how to use Python with the Raspberry Pi. I successfully followed the tutorial for how to have a Python script run on the Pi to check for new email and turn on a LED if any new messages ...
2
votes
2answers
21 views

How to get strftime 7 hours in the past?

I have a timestamp that is in a time zone 7 hours ahead of me. The timestamp is saved in the strftime format '%Y-%m-%d %H:%M'. How do I make this timestamp go 7 hours back? Example: Timestamp right ...
0
votes
2answers
27 views

Forcing base class functions to be used from the base class

The answer to this question is probably "W-what!? What the !@#$-- Stop!! That's a terrible idea!", but I would like to hear your thoughts... I have two classes and one inherits from the other. class ...
-2
votes
0answers
36 views

Sort a list based on another list in Python [duplicate]

I have a list of file sizes and a list of files. The two are lined up properly (fileSize[3] is the file size of the fourth element in fileList). I need to sort the file list based on that file size ...
1
vote
2answers
29 views

What's wrong with this tzinfo variable?

I have this line of code: datetime.datetime.fromtimestamp(0, "<DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>") And it keeps giving me this error: TypeError: tzinfo argument must be None or ...
4
votes
0answers
35 views

Python - how can i make the client to be able to connect multiple times?

When i use client1 = HTTPClient('192.168.1.2', '3') only it works but when i use both as below: client1 = HTTPClient('192.168.1.2', '3') client2 = HTTPClient('192.168.1.3', '3') then the whole thing ...
0
votes
2answers
14 views

Getting “TypeError: unhashable type: 'list'” while working with shelve

I'm trying to write a snippet of code that adds an ID to a set so I can see if its already been used, and stores the set in a file. I've been attempting to do this by using the Shelve module but I'm ...
1
vote
2answers
51 views

How do I fix this SyntaxError?

In my code I have these lines: if numVotes == 0: avId in self.disconnectedAvIds or self.resultsStr += curStr When I run the code I get this error? SyntaxError: illegal expression for augmented ...
-3
votes
1answer
44 views

Python Boolean Operation Wrong Results [on hold]

I have a part of Python code (Python 2.7 running in Pywin) that uses boolean values for the if statements. Below I am posting an example of results that do not make sense. When I run the code below, ...
0
votes
2answers
18 views

Guessing Game in Python Broken

As a beginner with some knowledge from past code reviews, I tried doing a code review, but somehow got the program to stop working as intended. Supposed to break loop after 5 games, only does this ...
0
votes
3answers
41 views

Hangman Program so far

So my program is this so far: def update(): print word counter = 0 blanks = len(word)*'-' blank_list = list(blanks) letter = raw_input('Please enter a single letter: ') for ...
0
votes
3answers
38 views

In Python 2.7 what is difference between var1 = [list(range(6))] and var2 =range(6)?

In ex32 of LPTHW I found that I could make a list by doing this: var1 = [list(range(6))] or var2 = range(6) But, when I print var1 in a for-loop using '%d' I get a typeError saying it wants a ...
0
votes
2answers
31 views

sqlite3.ProgrammingError: Cannot operate on a closed database. (python / sqlite)

I am using a common function to execute all sqlite queries in a class. It all works until I use a for loop with more than one item in the list. Here's the common function that executes sqlite ...
0
votes
1answer
20 views

How can i put a value in HTML and execute a python code with that value as a variable

I found this Python code: #! C:\python27 import urllib2 from bs4 import BeautifulSoup url='http://www.google.com/' conn = urllib2.urlopen(url) html = conn.read() soup = BeautifulSoup(html) links ...
-3
votes
0answers
16 views

Searching for people using the Facebook SDK and Python

Generally to search for specific page , I write something like this: (g.request('search',{'q':'Hercules', 'type':'Page' ,'limit':5}) Here, I am trying to get 5 Hercules pages. Now, suppose if I ...
1
vote
0answers
27 views

python to print html file to default printer

I want to print html file via default printer on windows os I am already doing this using code: import os os.startfile("C:\\Users\\user\Desktop\\table.html", "print") the problem is no colors and ...
2
votes
1answer
28 views

How can I look for a certain pixel colour on my screen, in a specific area using Python's PIL?

How can I look for a certain pixel colour on my screen, in a specific area using Python's PIL? I need a function that will initiate a command in Python 2.7, if a certain pixel colour appears in a ...
0
votes
1answer
40 views

next page link need to find python

I want to know how Im able to find the next page link the script is given below there is main div class="abc" that covers the next page link which is www.abc.com #base url ...
1
vote
2answers
21 views

How to find the Pi subscript

I tried to find out, in which digit does any given name occurs. code goes like, iterator = 97 int_lis = [] lis = [] lis.append('@') for item in range(iterator,iterator+26) : ...
0
votes
1answer
24 views

Header of data file disappears when sorting

I have a csv file with rows of data. The first row is headers for the columns. I'd like to sort the data by some parameter (specifically, the first column), but of course keep the header where it is. ...