text_a stringlengths 5 12.3k ⌀ | text_b stringlengths 36 15.7k | Score int64 1 3 |
|---|---|---|
if ntop installed look example files usrsharentoppython ubuntu package version least if epydoc installed run make within usrsharentoppythondocs directory generate documentation once about online documentation python ntop engine python api link work correctly seems like bug requires work part user fix link | can anyone point towards tutorials using python api ntop luca deris paper in web interfaces online documentation python engine i think link error does anyone access document repost online | 2 |
one fell swoop divmod the docs divmod found | x x xintx ok x want round say use later way dont know x time real place start even possible know change int want store ever took store right id write statments figure say doent strike best way | 3 |
you correct height attribute change that attribute tell actual height height configured the actual height depends factors much text wrap length font widget geometry managed tkinter font objects measure method lets determine tall wide string given font you get font widget use method determine much space required string | i label i going put content different sizes i would like know high i need make label i size window stay different content sizes i strategy seems complicated i want set label given width wraplength l labelroot l width l wraplength l text testing now i want query label find many lines used l height stays best i able come... | 1 |
take number modulus | x x xintx ok x want round say use later way dont know x time real place start even possible know change int want store ever took store right id write statments figure say doent strike best way | 1 |
yes exact way wrote your code fine | for example mymessage dear hello name jj print mymessage name does python feature accomplishing something like code | 3 |
python really concept constant find c so fairly good approach i would actually argue one example consenting adults hold terribly well think language awesome constant every would nice | for example mymessage dear hello name jj print mymessage name does python feature accomplishing something like code | 2 |
your code correct i believe preferred way mymessage dear hello mymessageformat jj dear jj hello preferred possible future replacement operator format method as mentioned mark lutz learning python fourth edition format method features found expression make substitution values explicit trades operator arguably mnemonic m... | for example mymessage dear hello name jj print mymessage name does python feature accomplishing something like code | 1 |
yield sucks continuations better actually python yield continuation what continuation a continuation saving present point execution state one continue point later that precisely python yield also precisely implemented it understanding python continuations delimited however i know much i might wrong fact nor i know impl... | i writing code phd research starting use scala i often text processing i used python whose yield statement extremely useful implementing complex iterators large often irregularly structured text files similar constructs exist languages eg c good reason yes i know previous threads but look like hackedup least badly expl... | 3 |
data x data x mathlogy | i looking elegant way something like datai else logdatai xrangelendata so data i want make list fyi output csv file | 1 |
data itertoolschainxlogx x data make list | i looking elegant way something like datai else logdatai xrangelendata so data i want make list fyi output csv file | 1 |
if i understand correctly actually swapping instances class classes instance state kept two possible places slots dict if swap basically swapped instances retaining original name bindings one caveat class cannot immutable must define hash instances already members set keys dictionary would become irretrievable if i thi... | i big class lots members quite references instances class lying around unfortunately reasonable reasons references wrong way around instead recreating finding updating everywhere objects referenced adding extra level indirection time i access class individually swapping members i defined method def swapself assertisins... | 3 |
sumx mathlogx x data | i looking elegant way something like datai else logdatai xrangelendata so data i want make list fyi output csv file | 1 |
the premise question seems want exactly python yield want reasonable suggestions thing different way scala if true important use python it quite nice language unless phd computer science using scala important part dissertation already familiar python really like features design choices use instead anyway actually want ... | i writing code phd research starting use scala i often text processing i used python whose yield statement extremely useful implementing complex iterators large often irregularly structured text files similar constructs exist languages eg c good reason yes i know previous threads but look like hackedup least badly expl... | 3 |
matplotlib python closer may think httpsgithubcommatplotlibmatplotlibpy httpwwwlfduciedugohlkepythonlibsmatplotlib why use pythonstartup instead sitecustomizepy localhost cat startuppy future import printfunction future import division localhost export pythonstartup localhost python python va jun gcc apple inc build do... | in python using future import division printfunction i print showing however possible automatically imported python startup i tried use sitecustomizepy special module inport valid inside module shell as i sure people ask i need teaching python teenagers i noticed integer division easy decided switch python however one ... | 3 |
the smtplib prints directly stderr eg line smtplibpy printstderr connect fail host you either monkey patch sysstderr import smtplib smtplibstderr run mail code i might also suggest patching smtplibstderr custom object write method wrap logging code using logging library instance import logging import smtp class stderrl... | as know python smtplib debug levelwhen i set true param print send information the problem i try get debug info log file they stay cmd console how i log info like connect connect reply esmtp winwebmail ready httpwwwwinwebmailcomrn reply retcode msg esmtp winwebmail ready httpwwwwinw ebmailcom connect esmtp winwebmail r... | 3 |
no need compile new version python x you start as found sitecustomizepy work this future import identifier import it flags module compiled special rules any module uses features must future import well interactive console the following shell command start interactive console division printfunction active python ic futu... | in python using future import division printfunction i print showing however possible automatically imported python startup i tried use sitecustomizepy special module inport valid inside module shell as i sure people ask i need teaching python teenagers i noticed integer division easy decided switch python however one ... | 1 |
you explicitly say appears using matplotlib i say certain posted i guess happening already bound save figure matplotlib figure and default matplotlib uses tkbased backend thus tk error there need use urwid module matplotlib hooks things like going need disconnect hooks need as simple standalone example reproduce proble... | i try understand python codes i want select part open image zoom save selected part right trying quickly save open zoom image pressing key for explain better need fire function savefig pressing keyboard key i tried use urwid module import urwid import pil import image imimageopenfigtif imshowim def saveinput input save... | 1 |
check pyftpdlib giampaolo rodola it one best ftp servers python it used google chromium browser bazaar version control system it complete implementation python rfc aka ftp server implementation spec from commandline python pyftpdlib alternatively myserverpy usrbinenv python pyftpdlib import servers pyftpdlibhandlers im... | is possible one line command python simple ftp server i like able quick temporary way transfer files linux box without install ftp server preferably way using built python libraries nothing extra install | 3 |
it worked fine fixing two things variable meta metadata nd arg table referred global variable lines createuserstable metadatacreateallengine moved bottom functions called defining as syntax error i guess file got invalid characters last line printed screen my suggestion delete last line retype | i getting maddening syntax error i run following program here error file createthedatabasepy line syntaxerror invalid syntax here code long repetitive easy skim import sqlalchemy sqlalchemy import engine createengine sqliteusersbenscholzdropboxomnicloudomniclouddevdb meta metadata createuserstable createaccountstable c... | 1 |
the string formatting operator also neat things string this foos also foos print string foo bar this bar also bar this really useful repeating one argument sure beats formatstring bar bar you also padding number formatting | for example mymessage dear hello name jj print mymessage name does python feature accomplishing something like code | 1 |
inheriting nothing creates oldstyle class different behaviour newstyle classes i remember specifics see explanation general rule reason favour oldstyle classes always inherit object nothing else | in one past questions answerer suggests better inherit object class want create like scratch need inherit class for example like i always class myclass class inherits nothing def initself pass for suggested class suggestedclassobject class inherits object type def initself pass i confused benefits disadvantage approach... | 2 |
to deal path file names best use builtin module ospath python please look function dirname basename split module | i files i want foo bar left split dn cxdata files f cxdatafootxt f cxdatsbartxt i tried fsplit i thought since dn txt predefined i could subtract nope split work | 1 |
using proper path handling methods os f cxdatafootxt import os ospathbasenamef footxt ospathdirnamef cxdata ospathsplitext f cxdatafoo txt ospathsplitext ospathbasenamef foo txt | i files i want foo bar left split dn cxdata files f cxdatafootxt f cxdatsbartxt i tried fsplit i thought since dn txt predefined i could subtract nope split work | 3 |
being big fan jquery i recommend pyquery offers strong selector like jquery pyquery import pyquery pq dom pqfile yourhtml read print lendom hsectiontitle table h element class name you use id name target class id next adjacent element in case next table element here i added table returns a elements inside table | i would like count urls specific class class h classsectiontitleinsiders at loews corp lh links like hrefresearchstockspeoplerelationshipasppersonidampsymbollus i would like count number kind links class this program i wrote count work headings bsfind h text insiders at loews corp l section headingsfindnext aa sectionf... | 1 |
let try answer questions in dev mode hit ctrl alt t get shell however trimsecure shell let wish you load type os usb install i friends ubuntu everyone moved back chromeos may case different cloud cloud ide give ability develop python you read blog post i wrote past developers chromebook httpgreenidowordpresscomwebdevel... | i would like use samsung chromebook develop app engine using python unfortunately possible i browser there online ide like codule good enough yet so regards i questions is way hack chrome os pull native linux is way install second os chromebook i new samsung chromebook first one is chrome os extension help programming ... | 3 |
some time ago i forked smtplib added logfile option among things you try want it also new name smtppy | as know python smtplib debug levelwhen i set true param print send information the problem i try get debug info log file they stay cmd console how i log info like connect connect reply esmtp winwebmail ready httpwwwwinwebmailcomrn reply retcode msg esmtp winwebmail ready httpwwwwinw ebmailcom connect esmtp winwebmail r... | 1 |
it likely optimisation side browser trying reuse connection see httpenwikipediaorgwikihttppersistentconnection if want make sure sniff traffic using wireshark although localhost based address may require fancy setup | i binding socket localhost order make simple server here simple python script i used create server import os import socket import fcntl tuples socketgetaddrinfo localhost socketafunspec socketsockstream socketaipassive socketaiaddrconfig res tuples af socktype proto canonname sockaddr res sock socketsocketaf socktype p... | 1 |
you iterate columns table first table sqlalchemyormattributes import managerofclass dummytable managerofclassdummymappermappedtable finally query col dummytablecolumns dummy sessionquerydummyfiltercol first or maybe actually generating specific set columns elaborate function showing in case use getattr no really range ... | i table many columns class dummyobject tablename dummies c columninteger c columninteger c columninteger cn columninteger can i query columns individually without specifying column name manually range n cname cd dummy dbsessionquerydummyfilterbyfirst thanks | 2 |
selfassertcontainsresponse invalid message | i like simulate requests views django i writing tests this mainly test forms here snippet simple test request djangotests import testcase class myteststestcase def testformsself response selfclientpostmyform something something selfassertequalresponsestatuscode get page back error the page always returns response wheth... | 2 |
to wrap comment tomasz zielinski real answer for several reasons indeed better let apachenginxetc work sending files most servers mechanisms help usecase apache lighttpd xsendfile nginx xaccelredirect the idea use features django like nice urls authentification methods etc let server work serving files what django view... | so i want serve couple mps folder homeusernamemusic i think would big deal i bit confused using generic views url urlspy urlr songpsongidddownload songdownload name songdownload the example i following found generic view section django documentations httpdocsdjangoprojectcomendevtopicsgenericviews it way bottom i sure ... | 3 |
i think want test form test form view form rendered example get idea djangotest import testcase myappforms import myform class myteststestcase def testformsself formdata something something form myformdataformdata selfasserttrueformisvalid tests relating forms example checking form data | i like simulate requests views django i writing tests this mainly test forms here snippet simple test request djangotests import testcase class myteststestcase def testformsself response selfclientpostmyform something something selfassertequalresponsestatuscode get page back error the page always returns response wheth... | 3 |
there way get usage statistics api this issue actively discussed aws forum years feedback aws team httpsforumsawsamazoncomthreadjspamessageid the alternatives would turn amazon s server log analyze another option would take advantage amazon devpay service thanks andy edit here official amazon s documentation related am... | is way programmatically access amazon s account usage data i building application charge endusers use amazon s bucket because i middleman aws end user putdelete operations i able keep track uploads storage usage i allowing users directly access files public access links i able directly monitor downstream usage as plan ... | 2 |
i would configure relation onetoone uselistfalse add property would wrap link relationship the sa configuration would look like code work fine creating updating deleting link you might need configure relation deleteorphan option cascade class submissionsbase tablename submissions id columninteger primarykeytrue created... | i learning use sqlalchemy i trying following storing title link two separate tables temp submissionstitleu facebook homepage linku httpfacebookcom sessionaddtemp sessionflush transactioncommit via class linksbase tablename links id columninteger primarykeytrue link columntext created columntimestamp defaultdatetimenow ... | 1 |
you use defaultdict list collections import defaultdict b c dd defaultdictlist k v miteritems ddvappendk dictdd b c if care dict defaultdict omit last step und use defaultdict directly | for example i call function passing dictionary parameter invmap b c b c invmap b c c b invmap b c b c if map b i invert map get invmap b using dictvk k v mapiteritems anyone knows case | 3 |
you probably use defaultdict setdefault def invertdictionaryorigdict result change defaultdictlist k v origdictiteritems resultsetdefaultv appendk | for example i call function passing dictionary parameter invmap b c b c invmap b c c b invmap b c b c if map b i invert map get invmap b using dictvk k v mapiteritems anyone knows case | 3 |
to create custom responses need use bottlebaseresponse object the documentation describes class seems quite easy use so achieve want create baseresponse object status code wish data need include return view | well i working bottle right and i wondering excatly i able build custom response i little script operates data i send i want send responsecode done modification i looking docs bottle find anything thanks advance | 1 |
the argument cursorexecute represents values need inserted database tuple sequence however consider example see happening jason jason jason jason the first example evaluates string instead correct way representing single valued tuple second evaluation anyhow code fix error selfcursorexecuteselect weight from equipment ... | using sqlite python i trying iterate list pull weight item database based item name i tried using parameter substitution suggested prevent sql injections work for example i use item selfinventorynames selfcursorexecuteselect weight from equipment where name item selfcursorclose i get error sqliteprogrammingerror incorr... | 3 |
why temporarily stop patch selfurlopenstop points real urlopen urlliburlopen put patch place selfurlopenstart | is way temporary undo patching using mock within sideeffect in particular i like make something like work mock import patch import urllib import unittest class simpletestunittesttestcase def setupself selfurlpatcher patch urlliburlopen selfurlopen selfurlpatcherstart def sideeffecturl interesting stuff first temporary ... | 1 |
have look django facebook there examples included link httpsgithubcomtschellenbachdjangofacebook also try list sharing flow fashiolista real life demo httpwwwfashiolistacomstylemodedamourlistultimatesummerwishlist click save photo album | i trying publish photo available server users photo album is job pythondjango done javascript and anyone example code i going round circles week i got users accesstoken permissions publish update basically something like djangopython so i call page upload photo server post users wall upload photo to album facebooks gra... | 1 |
the command works executed terminal except command the code running mv pdf testpdf type runs mv pdf testpdf the difference shell globs wildcard executing mv you simulate using glob module | i trying rename set pdf files desktop using simple python script i somehow successful my current code import ossubprocess path usersarmeddesktop file oslistdirpath command mv pdf testpdf mv command rename files testpdf subprocesscallcommand the output get code files renamed the command works executed terminal i using m... | 3 |
python going expand shell wildcard string default you also without subprocess but code lose pdf files except last one glob import glob import os path usersarmeddesktop oschdirpath filename globpdf osrenamefilename testpdf but i sure really want you need better destination name | i trying rename set pdf files desktop using simple python script i somehow successful my current code import ossubprocess path usersarmeddesktop file oslistdirpath command mv pdf testpdf mv command rename files testpdf subprocesscallcommand the output get code files renamed the command works executed terminal i using m... | 1 |
you looking zipfile stringio create stringio open zipfile add files send | please help problem i sorry sounds noobie coz i really there files jpg docs certain database would i select file database save zip file send browser httpresponse something like response httpresponsemimetype applicationzip response contentdisposition filenamegroupzip the part greatly bothers taking files database coz go... | 1 |
all multiprocessingpoolmap methods consume iterators fully demo code soon function called to feed map function chunks iterator one chunk time use groupernofill def groupernofilln iterable listgroupernofill abcdefg a b c d e f g ititeriterable def take yield listitertoolsisliceitn return itertakenext chunksize asyncresu... | i xx numpy array element matrix i need calculations matrices i want use multiprocessing module speed things the results calculations must stored xx array like original one result matrix element ijk original array must put ijk element new array to i want make list could written pseudoish way arrayijk j k pass function m... | 3 |
httpdocspythonorgextendingextendinghtml httpdocspythonorgextending httpenwikibooksorgwikipythonprogrammingextendingwithc httpwikicacrcaltechedudanseindexphpwritingcextensionsforpython | we developing software python two team know cc my question make plugins possible include dll python | 1 |
unless already existing cc libraries want integrate python waste time toss copy tutorial desks tell take days learn | we developing software python two team know cc my question make plugins possible include dll python | 3 |
when working flickrapi python frequently useful print xml returned api calls order see going in example add xmletree import elementtree top add print elementtreetostringfavs see structure returned rsp statok photosets page pages perpage total photoset photoset photoset photoset photosets rsp in real application want ch... | i wish list sets created user along set id i using flickrapi python here code the setname returning none output the elmget title returning none import flickrapi apikey apikey apisecret apisecret flickr flickrapiflickrapiapikey apisecret token frob flickrgettokenpartoneperms write token rawinputpress enter authorized pr... | 1 |
edit it seems certain equations definitely possible automate process see original answer left intact based many painful hours fighting latex equation settings failures notice missing elements huge equation blocks almost certainly possible convert latex python vice versa probably painful hand likely need spend time tidy... | i writing code long mathematical equations many trigonometric identities is way visualising expression latex making c python expression way around how enter check mathematical expressions see brackets etc right position use latex documents thanks advance | 2 |
it called bit vector bitmap try eg bitvector if want implement need use numeric object list use bitwise operations toggle bits eg bitmap bit bitmap bit enable bit bitmap amp bit disable bit | i big list represented integers default python i think randint range and i want optimize code utilizes much less memory the obvious way use bit represent numbers is possible build list real binary numbers python regards bruno edit thank from answers i found python default i found library installed macports osx saves tr... | 1 |
paths specified relative directory containing appyaml try handlers url dailybasic script dailybasicdailybasicpy did want map file indexhtml root url app engine automatically like web servers to mapping try something like url staticfiles indexhtml upload indexhtml | i making project using gae terrible problem i wanted make twitter bot i started first step posting tweets i made tweetstxt folder dailybasicpy here parts codes appyaml application mathgirlna version runtime python apiversion handlers url static staticdir static url dailybasic script dailybasicdailybasicpy url script ma... | 1 |
this uses bitstring module constructs bitarray object list bitstring import bitarray b bitarrayrandint range internally stored packed bytes take considerably less memory you slice index check set bits etc usual notation additional methods set modify bits to get data back binary string use bbin get byte packed data use ... | i big list represented integers default python i think randint range and i want optimize code utilizes much less memory the obvious way use bit represent numbers is possible build list real binary numbers python regards bruno edit thank from answers i found python default i found library installed macports osx saves tr... | 2 |
as delnan already said comment able use real binary numbers mean bitforbit equivalent memory usage integers longs course real binary numbers meaning address individual bits using bitwise operators easily hidden class also long objects become arbitrarily large ie use simulate arbitrarily large bitsets it going fast pyth... | i big list represented integers default python i think randint range and i want optimize code utilizes much less memory the obvious way use bit represent numbers is possible build list real binary numbers python regards bruno edit thank from answers i found python default i found library installed macports osx saves tr... | 1 |
you use rollyourown solution function overloading this one copied guido van rossum article multimethods little difference mm overloading python registry class multimethodobject def initself name selfname name selftypemap def callself args types tupleargclass arg args generator expression function selftypemapgettypes fu... | i know python support method overloading i run problem i seem solve nice pythonic way i making game character needs shoot variety bullets i write different functions creating bullets for example suppose i function creates bullet travelling point a b given speed i would write function like def addbulletsprite start head... | 3 |
static files served directly user url specified appyaml they cannot read application deployed servers serve static files infrastructure runs application if need read files script upload nonstatic if need serve files statically directly user browser read scripts need include copies files application although symlink non... | i making project using gae terrible problem i wanted make twitter bot i started first step posting tweets i made tweetstxt folder dailybasicpy here parts codes appyaml application mathgirlna version runtime python apiversion handlers url static staticdir static url dailybasic script dailybasicdailybasicpy url script ma... | 3 |
i would use pth file see httpdocspythonorginstallindexhtmlinstsearchpath a pth file file consisting one directory path per line it insert listed directories python path that may better executing shell scripts downsides complex installation break portability etc | ok i following situation i need edit pythonpath dynamically target pc now structure project trunk bin startscript dependencies dependencies from python i could startscript rootpath ospathsplitospathdirnameospathabspathfile dependenciesroot ospathjoinrootpath dependencies sys import path pathextendrootpath dependenciesr... | 1 |
have looked sympy it module generating latex python code actually quite bit sympy probably guess name python library symbolic computation the sympy library also includes builtin interpreter cd sympy directory sitepackages type ipython shell prompt with sympy interpeter things like in cosxseriesx out x â x â x â x â... | i writing code long mathematical equations many trigonometric identities is way visualising expression latex making c python expression way around how enter check mathematical expressions see brackets etc right position use latex documents thanks advance | 3 |
as far i know done the problem ironpython class clr class compatible clr class a clr class static ironpython class dynamic dlr far i know example provide ironpython classes net clr attributes need cmdlet development | i want able write powershell cmdlets using ironpython furthermore i need one cmdlet look environment add cmdlets powershell based contents for example reading directory adding cmdlet remove every filename sees | 1 |
i back jã¶rg w mittag answer the python implementation diioc lightweight completely vanishes to back statement take look famous martin fowler example ported java python pythondesignpatternsinversionofcontrol as see link container python written lines code class container def initself systemdata componentname componentc... | in java ioc di common practice extensively used web applications nearly available frameworks java ee on hand also lots big python web applications beside zope i heard really horrible code ioc seem common python world please name examples think i wrong there course several clones popular java ioc frameworks available py... | 3 |
you could update pythonpath environment variable moment update syspath startscript using osenviron dict | ok i following situation i need edit pythonpath dynamically target pc now structure project trunk bin startscript dependencies dependencies from python i could startscript rootpath ospathsplitospathdirnameospathabspathfile dependenciesroot ospathjoinrootpath dependencies sys import path pathextendrootpath dependenciesr... | 2 |
splitnum anything numsplit would valid solve problem splits spaces what want convert digit characters num numbers represent list comprehension digits intc c num then sum result expression | i trying make program whatever number entered user digits composing number added sum good done something wrong this simple i suppose though i struggling add together numbers i split do know i this attempt numrawinputinput number numsplit suma print num valid number else print num invalid thank | 2 |
you using rawinput prompt user function returns string composed digits case need make computations convert int here code could look like num rawinput input number suminti num print ok else print failed keep mind python x functions rawinput returns string input returns integers fails something else given python x rawinp... | i trying make program whatever number entered user digits composing number added sum good done something wrong this simple i suppose though i struggling add together numbers i split do know i this attempt numrawinputinput number numsplit suma print num valid number else print num invalid thank | 1 |
use map function in in mapinta out in summapinta out mapfunction sequence calls functionitem sequenceâs items returns list return values see docspythonorg this works rawinput returns string | i trying make program whatever number entered user digits composing number added sum good done something wrong this simple i suppose though i struggling add together numbers i split do know i this attempt numrawinputinput number numsplit suma print num valid number else print num invalid thank | 3 |
your first problem split split string characters splits string whitespace split to go character input string use split use character string i find hard read code variable names like lol rofl i changed your check intdigit excludes i assume accident i using intdigit including instead your current code prints error messag... | brief i trying write simple program checks given code valid the code valid three characters entered digits if code valid progam displays message thank we process order the output program error message the verification code valid please check credit card code input valid attempt lol rawinputwhat code rofllolsplit int ro... | 1 |
could rawinput aisdigit inta lena print yeah else print nope isdigit cool builtin function checks strings see made entirely digits you wrap inta tryexcept acts shortcircuit operator prevent inta evaluated isdigit returns false edit added lena | brief i trying write simple program checks given code valid the code valid three characters entered digits if code valid progam displays message thank we process order the output program error message the verification code valid please check credit card code input valid attempt lol rawinputwhat code rofllolsplit int ro... | 2 |
what trying check given input matches given pattern three digits case basically regular expressions made using regex code would look like import code rawinputwhat code rematchr code print code ok else print wrong code in regex means beginning string means digit could also means repeated times means end string for infor... | brief i trying write simple program checks given code valid the code valid three characters entered digits if code valid progam displays message thank we process order the output program error message the verification code valid please check credit card code input valid attempt lol rawinputwhat code rofllolsplit int ro... | 2 |
lol rawinputwhat code rofllolsplit split perform think separates parts string according space tab line ends int rofl loop using int variable name good idea int standard type introfl rofl list redefine int use lol instead loop digits intd witll throw exception digit print thank we process order else print the verificati... | brief i trying write simple program checks given code valid the code valid three characters entered digits if code valid progam displays message thank we process order the output program error message the verification code valid please check credit card code input valid attempt lol rawinputwhat code rofllolsplit int ro... | 1 |
i tried addressing problem unfound dynamics library compiling mysqldb module static libraries set static true sitecfg but generated error mysqlo still asking dynamic library to fix i added libraries block static setupposixpy | i downloaded followed install instructions mysql httpdevmysqlcomdownloadsmysql mysqldb python plugin httpsourceforgenetprojectsmysqlpython when i attempt import mysqldb python terminal i get error safira yanigisawa python version python safira yanigisawa python c import mysqldb traceback recent call lastï« file string... | 1 |
the java approach seems either get streaming dom parser python allows mixing two | stax seems pulling parser like sax without inversion control but i find equivalent python expandnode i interested first place i care inversion control for know pulldom stax parser point obtain current subtree dom node | 1 |
in develop branch new option change css hashing method httpsgithubcomjezdezdjangocompressor see line filterscssdefaultpy the settings i using compressenabled true compressoffline false compressstorage compressorstoragegzipcompressorfilestorage compresscsshashingmethod hash using mtime since differs servers there option... | i two servers behind load balancer each server running memcached server settings file identical servers defined short shared cache i want paths generated files identical servers client download for get working i need understand django compressor works what actual purpose cache django compressor is file content stored c... | 3 |
here nice demo using python opencv seems looking video code whether work without modification depends details spot the example uses cvhoughcircles identify circle object circle need replace | i working program python able following a webcam watching movement object moving path the object tracked marked big yellow spot i find yellow spot calculate centerpoint spot make calculations it would awesome centerpoint would draw picture remains whole time how would make happen ive already looked pil pygame opencv fi... | 1 |
from html specs the html syntax support namespace declarations so i think lxmlhtmlhtmlparser removesignores namespace however beautifulsoup parses html differently i thought might worth shot if also beautifulsoup installed use beautifulsoup parser lxml like import lxmlhtmlsoupparser soupparser import lxmlhtml import io... | i processing html files python lxml some edited ms word p tags written opampnbspop instance ie firefox interpret ms tags real p tags display line breaks op tags original editors formatted files eg spaces around nbsp lxml hand tidy processing html files see op tags changed proper p tags unfortunately tidying browsers di... | 1 |
since march mathjax cdn use without uploading files gae just make sure page header script typetextjavascript srchttpcdnmathjaxorgmathjaxlatestmathjaxjsconfigtexamsmmlhtmlormml script | i trying add tex support application i would like use mathjax render mathematics formulas client side since i gave server side solution explained the mathjax library pretty fat files easily installed app engine due files number limitation i experience mathjax library i open strategies like available mathjax cdn cutting... | 3 |
in code buttonself text open commandselfonsavepacksideleft first argument button instance tkinter container eg root window frame according httpcodegooglecompchildreneditorsourcebrowsetrunkeditornewpy self instance scrolledtext cannot contain widgets try changing self frm | why error tk attribute error traceback recent call last file editornewpy line module texteditormainloop file editornewpy line init buttonself text open commandselfonsavepacksideleft file cpythonliblibtktkinterpy line init widgetinitself master button cnf kw file cpythonliblibtktkinterpy line init basewidgetsetupself ma... | 1 |
check permissions classdump command chmod x classdump executable here docs chmod you might also need specify absolute path classdump path also try print joincommand see run pasting results shell | i trying execute following code python import ossubprocess glob import glob path usersarmedprivatesdks oschdirpath file globframework command classdump h file usersarmeddesktopheaders subprocesscallcommand on executing script get following error traceback recent call last file pyshell line module subprocesscallcommand ... | 1 |
encode turns unicode bytes decode turns bytes unicode you careful mix two your error means either chatter msgtext already bytes trying encode one worst features python lets tries first decode bytes using ascii limited encoding reencode whatever asked this fixed python use app engine app engine expects store unicode so ... | i roaming around forums asking questions issues related python utf encodingdecoding this time around i stumbled upon something initially seemed easy problem in previous question httpstackoverflowcomquestionsproblemswithpythoningoogleappengineutfandascii i asked ensure proper addition utf strings variables messagesappen... | 2 |
i would treat different problem if imagine origin centre figure want print manhattan distance cell greater half length edge for example could following import sys r rangerr x rangerr c absx absy r else sysstdoutwritec print produces | you may noticed last query similar task i trying replicate structure if think composed triangles i able produce corners individually put one another i know i would go putting together larger construct though would i attempt would i approach problem tackling single construct work line line i individual triangle parts i ... | 1 |
this worked w lines xrangew linesappendjoin w lines reversedlines l lines print l you could shrink wanted well lines join w xrangew print njoinlines lines output w | you may noticed last query similar task i trying replicate structure if think composed triangles i able produce corners individually put one another i know i would go putting together larger construct though would i attempt would i approach problem tackling single construct work line line i individual triangle parts i ... | 1 |
print n join range print n join range httpcodepadorgzldeog | you may noticed last query similar task i trying replicate structure if think composed triangles i able produce corners individually put one another i know i would go putting together larger construct though would i attempt would i approach problem tackling single construct work line line i individual triangle parts i ... | 1 |
for determinate mode want call start instead simply configure value widget call step method if know advance many bytes going download i assume since using determinate mode simplest thing set maxvalue option number going read then time read chunk configure value total number bytes read the progress bar figure percentage... | i want show progress bar downloading file web using urlliburlretrive method how i use ttkprogressbar task here i done far tkinter import ttk tkinter import root tk pb ttkprogressbarroot orienthorizontal length modedeterminate pbpack pbstart rootmainloop but keeps looping | 3 |
if need custom tool specific needs might want develop small django based wep app use celery spawn managed tasks you store log files models this probably require lot effort new web development if want cut programming time would like start generic solution might able start httpcodegooglecomppythonloggingserver some nonpy... | i like create web based control center i start processes watch statistics logs outputs also i would like run something like interactive python console webpage i know web development yet i know python something python based would nice could please suggest tools methods i learn implement ideally minimal effort achieve fi... | 1 |
encountered problem unmarshalling output p g option marshalloadsstr reads first record marshalloadstringiostr fails marshalload arg must file instead splitting suggested i used temporary file workaround import subprocess marshal tempfile tempf tempfiletemporaryfile subprocesspopencmd stdouttempfcommunicate tempfseek tr... | this really unfortunate situation maya comes code work pipe subprocesspopen p g edit csomefiletxt stdoutsubprocesspipestdout try record marshalload pipe listappend record except eoferror pass various versions work latest also works version ships maya course it throws error error typeerror file maya console line marshal... | 1 |
selflogger refer returned property threadawarelogger property | i code like class debugobject property def threadawareloggerself selfloggerinstanceforcurrentthread selfloggerinstanceforcurrentthreadselfclonemainlogger return selfloggerinstanceforcurrentthread def clonemainloggerself return loggerinstanceforcurrentthread class someotherclassobject def initself selfloggerdebugthreada... | 1 |
a couple things there method order query get first ten entries it would efficient loop the reason template work referring list rather individual entry it entry entrieslist ibnameib entryname br img srcimages entrypicture height widthimgbr ibingredientsib entryingredients br pi entrydescription ip ibcreated byib entryus... | can seem see i going wrong forgive i new i trying display newest objects within model here loop i used put objects within list put top newest recipe objects list entrieslist allrecipes recipesobjectsannotatecount id newestrecipeindex lenallrecipes index index try x recipesobjectsgetidnewestrecipeindex entrieslistappend... | 3 |
one way get whole property would make another property class someotherclass property def loggerself return selfdebugthreadawarelogger there might ways | i code like class debugobject property def threadawareloggerself selfloggerinstanceforcurrentthread selfloggerinstanceforcurrentthreadselfclonemainlogger return selfloggerinstanceforcurrentthread def clonemainloggerself return loggerinstanceforcurrentthread class someotherclassobject def initself selfloggerdebugthreada... | 1 |
the problem col a b c d e f g your list supposed contain strings need quote letter like quoted strings print statements unquoted treated identifiers variables classes functions etc end error additionally mentioned voooza answer need sliceindex input string gets first character letter gets second character number either... | question write program takes position chess board column col row value row checks whether position valid remember column chess board letter ranging a h inclusive row number inclusive a e valid inputs l if coordinates valid e programs prints the piece moved e otherwise prints the position valid my answer arawinputyou mo... | 2 |
col a b c d e f g otherwise looks variables a b c find | question write program takes position chess board column col row value row checks whether position valid remember column chess board letter ranging a h inclusive row number inclusive a e valid inputs l if coordinates valid e programs prints the piece moved e otherwise prints the position valid my answer arawinputyou mo... | 1 |
so if know basic c language your problem print element array so go like array int foriii print print array wrong similarly case iterating entrieslist assigning element variable entries now play entries entries entrieslist ibnameib entriesname br img srcimages entriespicture height widthimgbr ibingredientsib entriesingr... | can seem see i going wrong forgive i new i trying display newest objects within model here loop i used put objects within list put top newest recipe objects list entrieslist allrecipes recipesobjectsannotatecount id newestrecipeindex lenallrecipes index index try x recipesobjectsgetidnewestrecipeindex entrieslistappend... | 1 |
what get bytestring you must decode order get unicode string it basically comes bytestring fxevrier bytestringdecode utf u fã©vrier | i trouble get unicode values mysql queries here i mysqldb import connect mysqldbcursors import dictcursor con connect passwd db mydb user dbuser host localhost cursorclass dictcursor useunicodetrue charsetutf cursor concursor cursorexecute u select basicapplet res cursorfetchall printres titlede test title typeres titl... | 1 |
ospath module using list think looking syspath | running testpy gives traceback recent call last file testpy line module map parsermapospath startwmap typeerror module object subscriptable parserpy import configparser def stringisnumberstring try intstring except return false return true class map parser configparserrawconfigparser mapurl def initself map selfparserr... | 1 |
import logging import random class debugobject property def threadawareloggerself loggers logginggetlogger abc logginggetlogger def return selfanotherdebugmethodloggers def anotherdebugmethodselfloggers return randomchoiceloggers class someotherclassobject def initself selfdebugdebug property def loggerself return self... | i code like class debugobject property def threadawareloggerself selfloggerinstanceforcurrentthread selfloggerinstanceforcurrentthreadselfclonemainlogger return selfloggerinstanceforcurrentthread def clonemainloggerself return loggerinstanceforcurrentthread class someotherclassobject def initself selfloggerdebugthreada... | 1 |
you use producerconsumer threads the threads synchronized using queuequeue edit example producerconsumer system threading import thread queue import queue def producequeue nitems rangenitems queueputd print put queueformatd def consumequeue nitems nitems you need sort stop condition queueget print got queueformatd def ... | imagine text file mb i reading char char extracting useful information i actually main functions one reading file second extracting info something like def readerpath f openpath r source fread fclose true i read char char call function extractor def extractors i extract useful information now goal continue read extract... | 2 |
available x since using work correctly if upgrade get latest set commands able use command | i trying form fulltext search one mongodb collections la flowdock i create keywords entry document populate lowercased words fields document i search like prefixed search ex searchstring car foundshots connectionshotfind keywords recompile searchstringlowerlimitlimitskipskip the problem i try search multiple words ex s... | 1 |
groups empty since capturing groups httpdocspythonorglibraryrehtmlrematchobjectgroups group always returns whole text matched regardless captured group edited | when i run code print researchr groups i get result however group gives match shouldn groups give something containing match update thanks answers so means i research subgroups i use groups get match | 3 |
creating closure self technically bind function alternative way solving similar underlying problem here trivial example selfmethod lambda self lambda args selfdoargsself | in python way bind unbound method without calling i writing wxpython program certain class i decided nice group data buttons together classlevel list tuples like class mywidgetwxwindow buttons ok onok cancel oncancel def setupself text handler mywidgetbuttons this following line problem line b wxbuttonparent labeltextb... | 3 |
the reason capturing groups since use pattern httpdocspythonorglibraryrehtmlrematchobjectgroups and group returns entire search result even capturing groups httpdocspythonorglibraryrehtmlrematchobjectgroup | when i run code print researchr groups i get result however group gives match shouldn groups give something containing match update thanks answers so means i research subgroups i use groups get match | 2 |
you groups regex therefore get empty list result try researchr groups with brackets creating capturing group result matches part pattern stored group then get result | when i run code print researchr groups i get result however group gives match shouldn groups give something containing match update thanks answers so means i research subgroups i use groups get match | 1 |
to best knowledge groups returns tuple remembered groups ie groups regular expression enclosed parentheses so write print researchr groups would get response in general groups return tuple groups objects regular expression enclosed within parentheses | when i run code print researchr groups i get result however group gives match shouldn groups give something containing match update thanks answers so means i research subgroups i use groups get match | 3 |
in qt pyqt events called signals bind using slots docs generally speaking define slot decorator class windowimpl qtguiqmainwindow uitremormain uigraphs def init self buffer parent none configuration none initialisation gui setup however qtcorepyqtslotint nameonconfselectorcombocurrentindexchanged def confchanged self n... | maybe i jumping deep end i give shot here useful features tkinter the tkinter canvas widget object oriented drawing canvas the elements drawing essentially widgets moved modified bound events tkinter uses bindings trigger callbacks the event passed string custom events easily created eventgenerate tkinter method waits ... | 1 |
httpsdocsdjangoprojectcomenstabletopicstestingtoolsdjangotestsimpletestcaseassertformerror djangotests import testcase class myteststestcase def testformsself response selfclientpostmyform something something selfassertformerrorresponse form something this field required where form context variable name form something ... | i like simulate requests views django i writing tests this mainly test forms here snippet simple test request djangotests import testcase class myteststestcase def testformsself response selfclientpostmyform something something selfassertequalresponsestatuscode get page back error the page always returns response wheth... | 3 |
it sounds like mean line profiler something measures time spent ie instrumenting within line i hope mean time wallclock time real goodsize software look cpu time going missing lot another way stacksampling wallclock time zoom ltprof profilers since every line stack sample localized line code using map pdb file way debu... | i trying determine necessary write line profiler language like available python matlab a naive way interpret line profiler assume one insert time logging around every line definition line dependent parser handles whitespace first problem it seems one needs use parse tree insert timings around individual nodes is conclu... | 2 |
i know vpython perusing tutorial i would guess python range | after spending last months learning matlab seems i need switch vpython matlab colon operator comes handy often i found equivalent vpython for reference matlab is easy way thing vpython | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.