Data dodania Pytanie
2017-01-06 15:01 Run python 2.7 inside python 3x virtualenv »
I have a python 3.5x virtualenv, I have some older python 2.7 scripts I'd like to run inside this python 3.5x virtualenv, but obviously the two enviro...
(0) odpowiedzi
2017-01-06 08:01 How to pass a list as a function's arguments »
If I have a function: def run(time, message, time_span_pattern): ... And a list like: run_args = ['1s', '1 second alarm', <_sre.SRE_Pattern...
(1) odpowiedzi
2017-01-05 20:01 ZipFile.testzip() returning different results on Python 2 and Python 3 »
Using the zipfile module to unzip a large data file in Python works correctly on Python 2 but produces the following error on Python 3.6.0: BadZipFil...
(3) odpowiedzi
2017-01-05 13:01 About property class in a python »
I saw a python snippet as below when seeking for a tutorial to property in python: class Celsius: def __init__(self, temperature = 0): se...
(2) odpowiedzi
2017-01-03 17:01 Attempting to update the module beautifulsoup4 yields the error AttributeError: 'list_iterator' object has no attribute 'next' »
I somehow broke Spyder within Anaconda and couldn not even get it running again (some issue with connecting to the C library) so I uninstalled/deleted...
(0) odpowiedzi
2017-01-01 16:01 Detach from running process »
I am facing a funny situation: I'm developing a flashlight plugin to trigger an alarm at some point in the future. The problem is, flashlight kills ...
(1) odpowiedzi
2017-01-01 14:01 Make a thread that continues when program is stopped »
Is it possible to make a thread that continues when the program is stopped? When I first heard of daemonic threads, I thought that might be what I wa...
(0) odpowiedzi
2017-01-01 10:01 wait function that uses while »
I just wrote a function that looked like this: def block_for(seconds): """Wait at least seconds, this function should not be affected by the comp...
(2) odpowiedzi
2016-12-31 20:12 schedule code to execute at some time later »
How can I schedule some code to be executed at a certain time later? I tried: import time import datetime time.sleep(420) print(datetime.datetime.n...
(4) odpowiedzi
2016-12-31 18:12 class attribute doesn't get assigned correctly »
I am trying to loop an alarm (in the file beep.wav) and show an alert. Once the alert is closed, I want to instantly stop the alarm. I am attempting...
(2) odpowiedzi
2016-12-31 07:12 What is the difference between rw+ and r+ »
I stumbled onto this stackoverflow question while doing some file IO: Confused by python file mode "w+" r for reading w for writing...
(1) odpowiedzi
2016-12-30 17:12 handling iTunes plist with 3,006 values for key in python 2 with plistlib »
I'm trying to handle iTunes plist with plistlib under Python 2.7 on a Mac OS El Capitan system. The problem is get('Tracks') returns 3,006 values that...
(1) odpowiedzi
2016-12-27 07:12 Behaviour of translate() method in python 3.x unlike in python 2.x? »
Why does translate() method in python 3.x throw an TypeError if it is passed with 2 arguments unlike in python 2.x? This is my code: import os def ...
(0) odpowiedzi
2016-12-27 05:12 PyBrain QTable (ActionValueTable) not changing »
I followed a blog post (here) where the author wrote a program with PyBrain to learn how to play Blackjack. He outlines that he is using a Q-Table tha...
(0) odpowiedzi
2016-12-25 16:12 What does 'with a twist' mean when help(help) is called in Python? »
help(help) says This is a wrapper around pydoc.help (with a twist). What is the twist? $ python Python 2.7.10 (default, Jul 30 2016, 19:40:32) [GC...
(1) odpowiedzi
2016-12-25 12:12 what is the wrong with this script »
def hotel_cost(nights): cost = nights * 40 return cost def plane_ride_cost(city): if city == "charolette": cost = 180 elif cit...
(1) odpowiedzi
2016-12-22 16:12 convert file:// URI to open parameter string in Python 2 »
given a URI such as "file:///Volumes/Shared/1-05%20Born%20to%20be%20Wild.m4a". What is the easiest way to convert this to "/Volumes/Shared/1-05 Born t...
(1) odpowiedzi
2016-12-22 16:12 How can I determine the function in which a closure was created? »
This code in Python 2.7 creates a closure around func, enclosing the par variable: def creator(par): def func(arg): return par + arg ...
(2) odpowiedzi
2016-12-21 16:12 How to decompile exe compiled by pyinstaller.py »
I am new on python world, I have a exe app that compiled by pyinstaller.py using this command line code c:\Path\To\Python\python.exe pyinstaller.py --...
(0) odpowiedzi
2016-12-20 13:12 Getting error- UnboundLocalError: local variable 'token' referenced before assignment »
Getting this error while loading the checkout page. Using django framework and stripe. stripe.api_key = settings.STRIPE_SECRET_KEY def checkout(reque...
(0) odpowiedzi
2016-12-19 07:12 pyforms cannot import conf from pysettings »
This is my python file: import pyforms import pyside from pyforms import BaseWidget from pyforms.Controls import ControlText from pyfo...
(1) odpowiedzi
2016-12-18 11:12 Django 1.10 redirect view not working »
My redirect to another view is not working in django 1.10 Views.py from django.shortcuts import render, redirect # Create your views here. from for...
(2) odpowiedzi
2016-12-16 10:12 Unicode Regex in Python 3 (from Python 2 Code) »
I'm trying to convert my Python 2 script to Python 3. How do we do Regex with Unicode? This is what I had in Python 2 which works It replaces quotes ...
(2) odpowiedzi
2016-12-16 05:12 Python beginner - Am I doing it right? Quiz with scores »
#Quiz answer variables go here! ca1 = cringe_crew[0] ca2 = cucks[0] ca3 = 5 ca4 = cringe_crew[1] ca5 = 'No' #Questions q1 = "Question 1 - Who do we r...
(2) odpowiedzi
2016-12-15 18:12 Unable to pass argument from batch file to python file »
I am trying to pass an argument from batch file to my python file. I followed the steps given in these two links: Passing Argument from Batch File t...
(1) odpowiedzi
2016-12-15 08:12 get current id of widget on python / kivy »
i'm making a sort of android lock thing on kivy, and to draw the line, I need to get the id of the widget the mouse is on, so I assing an id to each o...
(1) odpowiedzi
2016-12-12 20:12 Get heavily nested li elements »
I have looked around on lots of posts regarding bs4 and getting html elements, at which I have suceeded, however, when I try to get nested elements wh...
(0) odpowiedzi
2016-12-12 04:12 How to test that PyPi install will work before pushing to PyPi? (Python) »
I have been having some issues figuring out how to get my Python package processed up to PyPi so I can install it easily with other dependencies for o...
(1) odpowiedzi
2016-12-09 15:12 Divide values in Python »
I made a xlrd to json parsing script, which doesn't divide variables. It always returns zero... the code which I am using to divide the variables is: ...
(4) odpowiedzi
2016-12-08 22:12 An old-style class works, new-style class broken »
class A_old: def __getattr__(self, attr): print 'getattr', attr return super(A_old, self).__getattr__(attr) # <-- note: don't ...
(1) odpowiedzi
2016-12-06 12:12 Python: Convert tuple to comma separated String »
import MySQLdb db = MySQLdb.connect("localhost","root","password","database") cursor = db.cursor() cursor.execute("SELECT id FROM some_table") u_data...
(3) odpowiedzi
2016-12-05 18:12 Surround emoji with spaces »
I used this post to make a regex that would find emojis in a string of text and simply stick some space characters on either side. my regex code: try...
(1) odpowiedzi
2016-12-05 11:12 Pass unicode instead of string from robot framework to python »
I have a robot framework file where I am calling a python function and passing it an argument. I want to pass the argument to python as a Unicode, but...
(1) odpowiedzi
2016-12-05 06:12 Python 2 and 3 compatible way to call intern() »
How do I write code that uses Python's intern that will work (be compatible) with both Python 2 and Python 3? Is there a clean way to do it? In Pyth...
(2) odpowiedzi
2016-12-03 11:12 I do not know how to define the two inputs (martian and plutonian) »
My code is simple yet the error has me baffled. The following is my code: from random import randint #I import the required modules for this program...
(0) odpowiedzi