This One is ULTIMATE. (Dont' Miss)
Hi Everyone, http://surkumarm.googlepages.com/home I found a cool Websites which can be a great resource to making easy money for Home Moms, kids, Students and other people who are looking for making some easy Money Online. This website talks about programmes launched by Giant companies like Amazon, Google and E-bay etc. and there is no participatioin fee. It provides great information about how you can make great money Online. Of course it won't come in the first day but as you start understanding how these programmes work, the potential for money making will be limitless. Here is the link and it has changed my life. I hope it does the same for you. :) http://surkumarm.googlepages.com/home -- http://mail.python.org/mailman/listinfo/python-list
Re: how to handle captcha through machanize module or any module
On Wednesday, December 18, 2013 at 6:26:17 PM UTC+5:30, Jai wrote: > please do replay how to handle captcha through machanize module I have the same issue, nothing find a solution yet! -- https://mail.python.org/mailman/listinfo/python-list
Re: argparse and subparsers
On Sunday 26 June 2016 02:51 PM, Joseph L. Casale wrote: > I have some code where sys.argv is sliced up and manually fed to discrete > argparse > instances each with a single subparser. The reason the discrete parsers all > having a > single subparser was to make handling the input simpler, the first arg in the > slice > could be left in. > > This has become unmaintainable as the manual slicing is always subject to a > new case > by where a parser has a positional, switch or optional parameter for example. > Also, since > argv is grouped by subparser specifiers, if a parameter has input that > matches a keyword > it all goes pear shaped. > > The underlying root of this mess is a long unaddressed limitation in argparse > to support > multiple subparser specifications on the same invocation: > > prog.py -x -y 42 -foo bar subParserA -a 1 -b 2 subParserB -a 1 -b 2 > subParserB -a 1 -b 2 > > The base arguments (-x -y 42 -foo bar). > An invocation of "subParserA" and its arguments (-a 1 -b 2). > Two invocations of "subParserB" and their arguments. > > etc... > > I have seen some creative ways to overcome this on stacktrace, however I > thought I'd > see what people here have done. The code is pinned at 2.7 and while several > people > have created alternate implementations which address many of argparses > failures, its > desired to stick to base lib but that can easily be changed given a > compelling reason > if an alternate implementation exists that works well. Not sure if this fits the bill, or makes sense here, but I came cross "docopt" which touts itself as a "Command-line interface description language". I used it in a project and it seems to be pretty easy to use as well as elegant. It stores the arguments & values as a dictionary, keyed by the argument. from docopt import docopt arguments = docopt(__doc__, version='0.2') # Set verbose flag verbose = False if arguments['--verbose']: verbose = True elif arguments['-q']: verbose = False # If --noencrypt, --nosign or --notransfer is specified, put that in config if arguments['--no-encrypt']: config['noencrypt'] = True else: config['noencrypt'] = False if arguments['--no-sign']: config['nosign'] = True else: config['nosign'] = False if arguments['--no-transfer']: config['notransfer'] = True else: config['notransfer'] = False and so on ... -- https://mail.python.org/mailman/listinfo/python-list
Re: argparse and subparsers
On Monday 27 June 2016 06:28 AM, Steven D'Aprano wrote: > On Monday 27 June 2016 15:34, Lawrence D’Oliveiro wrote: > >> On Monday, June 27, 2016 at 4:56:10 PM UTC+12, Sachin Garg wrote: >> >>> # Set verbose flag >>> verbose = False >>> if arguments['--verbose']: >>> verbose = True >>> elif arguments['-q']: >>> verbose = False >> >> Don’t you just love code (and commenting) like this... > > > Not particularly, but what are you going to do? You need to support a minimum > of three cases: > > - a default setting; > - the case where the user passes --verbose; > - the case where the user passes -q; > > (I'm not sure why --verbose take a long argument but no short argument -v; > and > likewise why there's a -q short argument but no --quiet long version. Oh > well.) It is there. The way docopt works (https://github.com/docopt/docopt) is that it uses a "usage pattern" formatted using doctring conventions. In my case (snippet below), this pattern was: """Process Files: De-identify, encrypt and transmit data. Usage: processFiles.py [-hvq] [--config=FILE] [--encryptkey=key] [--signkey=key] [--no-normalize] [--no-encrypt] [--no-sign] Options: -h --help show this help message and exit -v --verboseverbose mode -q quiet mode (default) --config=FILE read configuration FILE (default: config.json) --encryptkey=KEYset GPG encryption key to KEY(default: from config file) --signkey=KEY set GPG signing key to KEY (default: from config file) --no-normalize do not normalize CCD/CSV (default: normalize) --no-encryptdo not encrypt output (default: encrypt) --no-sign do not sign output (default: sign) --no-transfer do not transfer output (default: transfer) """ So, the short "-v" option is taken care of. > A simple test-and-set for each argument is the simplest, most > straight-forward > way of handling this. It's not *pretty* or *elegant* code, but it is the > easiest to read, write and comprehend, and in my opinion much better than > alternatives involving ever more arcane method calls to ever more complicated > classes. The code above does seem amateurish. However, I think that it is easier to "waste" a few variables and allow for the ability to do printf() debugging, then write code using esoteric data structures. > I don't have experience with docutils and cannot judge whether or not > Sachin's > snippets are good or bad examples of use, but find myself going back to the > good old fashioned GNU style command line parser whenever I need a few > command > line options. If you find yourself writing subparsers and "mandatory options" > and needing entire help screens to describe single arguments (as in "foo > --help > arg") then really I think you should give up the pretence that you're dealing > with command line options, and you should write a mini-language for your > application. > > (hg, git, memcoder, soc etc. I'm talking about you.) -- https://mail.python.org/mailman/listinfo/python-list
Please solve this problem
-- https://mail.python.org/mailman/listinfo/python-list
Re: Please solve this problem
Rply if solved On Mon, 9 Mar, 2020, 11:47 AM sachin thakur, wrote: > -- https://mail.python.org/mailman/listinfo/python-list
pyqt problem
Hi I am learning pyqt, can any one help me to make instances of pushbutton wherever cursor will be clicked on canvas,like a circuit simulator where we add components on canvas just by left or right click. Thanks & Regards, Sachin -- https://mail.python.org/mailman/listinfo/python-list
Re: pyqt problem
On Thursday, October 2, 2014 3:19:22 PM UTC+5:30, Sachin Tiwari wrote:
> Hi
>
> I am learning pyqt, can any one help me to make instances of pushbutton
> wherever cursor will be clicked on canvas,like a circuit simulator where we
> add components on canvas just by left or right click.
>
>
>
> Thanks & Regards,
>
> Sachin
Hi
swch = QPushButton('', self)
swch.setToolTip('Switch ')
swch.setCheckable(True)
swch.setIcon(QIcon('sw.png'))
swch.setIconSize(QSize(40,40))
swch.move(05, 25)
swch.clicked.connect(self.switch)
The above code will make a push button on canvas, now what I want when I will
click on this button it get ready to drop anywhere on canvas by left click,I
mean if I click 10 times on canvas 10 push button will be there.
--
https://mail.python.org/mailman/listinfo/python-list
pyqt darg and drop
Hi
I want to drag and drop push multiple push buttons but its working for only for
last button. And I want to connect them by a wire.
Please help.
import sys
from PyQt4 import QtGui, QtCore
class Button(QtGui.QPushButton):
def mouseMoveEvent(self, e):
if e.buttons() != QtCore.Qt.RightButton:
return
mimeData = QtCore.QMimeData()
mimeData.setText('%d,%d' % (e.x(), e.y()))
pixmap = QtGui.QPixmap.grabWidget(self)
painter = QtGui.QPainter(pixmap)
painter.setCompositionMode(painter.CompositionMode_DestinationIn)
painter.fillRect(pixmap.rect(), QtGui.QColor(0, 0, 0, 127))
painter.end()
drag = QtGui.QDrag(self)
drag.setMimeData(mimeData)
drag.setPixmap(pixmap)
drag.setHotSpot(e.pos())
if drag.exec_(QtCore.Qt.CopyAction & QtCore.Qt.MoveAction) ==
QtCore.Qt.MoveAction:
print 'moved'
else:
print 'copied'
def mousePressEvent(self, e):
QtGui.QPushButton.mousePressEvent(self, e)
if e.button() == QtCore.Qt.LeftButton:
print 'press'
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.setAcceptDrops(True)
button = Button('Button', self)
button1 = Button('Button1', self)
button.move(100, 65)
button1.move(200, 65)
self.buttons = [button]
self.setWindowTitle('Copy or Move')
self.setGeometry(300, 300, 280, 150)
def dragEnterEvent(self, e):
e.accept()
def dropEvent(self, e):
mime = e.mimeData().text()
x, y = map(int, mime.split(','))
if e.keyboardModifiers() & QtCore.Qt.ShiftModifier:
button = Button('Button', self)
button1 = Button('Button1', self)
button.move(e.pos()-QtCore.QPoint(x, y))
button1.move(e.pos()-QtCore.QPoint(x, y))
button.show()
button1.show()
self.buttons.append(button)
self.buttons.append(button1)
e.setDropAction(QtCore.Qt.CopyAction)
else:
e.source().move(e.pos()-QtCore.QPoint(x, y))
e.setDropAction(QtCore.Qt.MoveAction)
e.accept()
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
ex = Example()
ex.show()
--
https://mail.python.org/mailman/listinfo/python-list
Re: pyqt darg and drop
On Saturday, October 4, 2014 3:35:33 PM UTC+5:30, Sachin Tiwari wrote:
> Hi
>
>
>
> I want to drag and drop push multiple push buttons but its working for only
> for last button. And I want to connect them by a wire.
>
>
>
> Please help.
>
>
>
> import sys
>
> from PyQt4 import QtGui, QtCore
>
>
>
>
>
> class Button(QtGui.QPushButton):
>
> def mouseMoveEvent(self, e):
>
> if e.buttons() != QtCore.Qt.RightButton:
>
> return
>
>
>
> mimeData = QtCore.QMimeData()
>
> mimeData.setText('%d,%d' % (e.x(), e.y()))
>
>
>
> pixmap = QtGui.QPixmap.grabWidget(self)
>
>
>
> painter = QtGui.QPainter(pixmap)
>
> painter.setCompositionMode(painter.CompositionMode_DestinationIn)
>
> painter.fillRect(pixmap.rect(), QtGui.QColor(0, 0, 0, 127))
>
> painter.end()
>
>
>
> drag = QtGui.QDrag(self)
>
> drag.setMimeData(mimeData)
>
> drag.setPixmap(pixmap)
>
> drag.setHotSpot(e.pos())
>
> if drag.exec_(QtCore.Qt.CopyAction & QtCore.Qt.MoveAction) ==
> QtCore.Qt.MoveAction:
>
> print 'moved'
>
> else:
>
> print 'copied'
>
>
>
> def mousePressEvent(self, e):
>
> QtGui.QPushButton.mousePressEvent(self, e)
>
> if e.button() == QtCore.Qt.LeftButton:
>
> print 'press'
>
>
>
>
>
>
>
> class Example(QtGui.QWidget):
>
> def __init__(self):
>
> super(Example, self).__init__()
>
> self.initUI()
>
>
>
>
>
> def initUI(self):
>
> self.setAcceptDrops(True)
>
>
>
> button = Button('Button', self)
>
> button1 = Button('Button1', self)
>
> button.move(100, 65)
>
> button1.move(200, 65)
>
>
>
> self.buttons = [button]
>
>
>
> self.setWindowTitle('Copy or Move')
>
> self.setGeometry(300, 300, 280, 150)
>
>
>
>
>
> def dragEnterEvent(self, e):
>
> e.accept()
>
>
>
>
>
> def dropEvent(self, e):
>
> mime = e.mimeData().text()
>
> x, y = map(int, mime.split(','))
>
>
>
> if e.keyboardModifiers() & QtCore.Qt.ShiftModifier:
>
> button = Button('Button', self)
>
> button1 = Button('Button1', self)
>
> button.move(e.pos()-QtCore.QPoint(x, y))
>
> button1.move(e.pos()-QtCore.QPoint(x, y))
>
> button.show()
>
> button1.show()
>
> self.buttons.append(button)
>
> self.buttons.append(button1)
>
> e.setDropAction(QtCore.Qt.CopyAction)
>
> else:
>
> e.source().move(e.pos()-QtCore.QPoint(x, y))
>
> e.setDropAction(QtCore.Qt.MoveAction)
>
> e.accept()
>
>
>
>
>
> if __name__ == '__main__':
>
> app = QtGui.QApplication(sys.argv)
>
> ex = Example()
>
> ex.show()
Change this line,
if drag.exec_(QtCore.Qt.CopyAction | QtCore.Qt.MoveAction) ==
QtCore.Qt.MoveAction:
--
https://mail.python.org/mailman/listinfo/python-list
Lookuperror : unknown encoding : utf-8
Hi, I wanted to read a file encoded in utf-8 and and using the following syntax in my source which throws me an error specifying Lookuperror : unknown encoding : utf-8. Also I am working on Python version 2.4.1. import codecs fileObj = codecs.open( "data.txt", "r", "utf-8" ) Can anyone please guide me how do I get utf-8 activated in my codecs or any setting needs to be done for the same before using codecs. Regards Sachin Punjabi. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 12:42 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > Hi, > > > I wanted to read a file encoded in utf-8 and and using the following > > syntax in my source which throws me an error specifying Lookuperror : > > unknown encoding : utf-8. Also I am working on Python version 2.4.1. > > > import codecs > > fileObj = codecs.open( "data.txt", "r", "utf-8" ) > > > Can anyone please guide me how do I get utf-8 activated in my codecs or > > any setting needs to be done for the same before using codecs.What OS? > > Where did you get your python distribution? Anyway, I believe > utf-8 codec was in the python.org distribution since the introduction > of unicode (around python 2.0). If you can't use utf-8 codec right out > of the box, something is really wrong with your setup. > > -- Leo The OS is Windows XP and also how do I incorporate python distribution. Disutils folder exists in the python folder. Anything I need to do there ? Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > The OS is Windows XPthen your installation is seriously broken. where did > > you get the > installation kit? have you removed stuff from the Lib directory ? > > It was already installed on my PC and I have no clue how it was installed or any changes has been done. I am just downloading newer version from python.org and will install and check it. I think there should be problem with installation itself. Thanx Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 1:54 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > Sachin Punjabi wrote: > > > > The OS is Windows XPthen your installation is seriously broken. where > > > > did you get the > > > installation kit? have you removed stuff from the Lib directory ? > > > > > > > It was already installed on my PC and I have no clue how it was > > installed or any changes has been done.Then it's a distribution of your PC > > manufacturer. They could omit some > modules like utf-8 codec. > > > I am just downloading newer > > version from python.org and will install and check it. I think there > > should be problem with installation itself.That's a right idea, I'd also > > recommend to leave the manufacturer's > python distribution alone. Do not remove it, do not upgrade it. Some > programs provided by the manufacturer can stop working. If the > preinstalled python was installed into c:\python24 directory, choose > some other directory when you install python from python.org. > > -- Leo I installed it again but it makes no difference. It still throws me error for LookUp Error: unknown encoding : utf-8. Sachin -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 12:47 pm, "thebjorn" <[EMAIL PROTECTED]>
wrote:
> Sachin Punjabi wrote:
> > I wanted to read a file encoded in utf-8 and and using the following
> > syntax in my source which throws me an error specifying Lookuperror :
> > unknown encoding : utf-8. Also I am working on Python version 2.4.1.You
> > shouldn't have to do anything to have the utf-8 encoding available.
> Check in your lib/encodings directory for a file name utf_8.py and the
> code in __init__.py in the same directory should take care of the
> mapping. This has been this way since at least Python 2.2 (which is the
> oldest version I have on this machine).
>
> If that doesn't give you a clue as to what is going on in your setup,
> try
>
> u'foo'.encode('utf-8')
>
> at the prompt and post the complete traceback.
>
> > import codecs
> > fileObj = codecs.open( "data.txt", "r", "utf-8" )That should work fine,
> > although I prefer to explicitly set the mode to
> "rb" (it will be set to binary mode behind your back regardless ;-)
>
> hth,
> -- bjorn
I tried with the code you specified on the command line and it works
very much fine.
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> u'foo'.encode('utf-8')
'foo'
>>>
Sachin.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > > -- Leo I installed the newer version on D drive and it was previously installed on C drive. Also the command which bjorn asked me to execute on command line worked very much fine. Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > > -- Leo Actually, I have placed the exe created from python in seperate folder other than Python root folder. Is this the cause of the problem but I had set Path to C:\Python24\ in Environment Variables. Sachin. -- http://mail.python.org/mailman/listinfo/python-list
free computer studies
free computer studies free computer programmes free computer education http://foodplantss.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
newbie question (for loop)
BB, I am getting error on the following syntax while running in Ipython and spyder and I failed to figure out why for i in range(len(list)) Error for i in range(len(list)) ^ SyntaxError: invalid syntax where list is a list defined as a collection of words and it is OK prints fine. Kindly advise. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler -- http://mail.python.org/mailman/listinfo/python-list
newbie question (latex Error in plotting)
Hi,
After computation of few array, when I am using plot(x,y) command I get
following error
'latex' is not recognized as an internal or external command,
operable program or batch file.
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (532, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (19, 0))
I can view the output as and it is fine. I tried the same in Ipython and
spyder, same error message.
Any advice.
Cheers
Sachin
********
Sachin Kumar Sharma
Senior Geomodeler
--
http://mail.python.org/mailman/listinfo/python-list
how to install the PLY (Python Lex-Yacc) package in windows
BB, I downloaded PLY (Python Lex-Yacc)<http://www.dabeaz.com/ply/> package for a script use it for parsing and looking to install under windows. It has setup.py file, and the command mentioned for installation is Python setup.py install Doesn't work for windows. Any advice. Cheers Sachin **** Sachin Kumar Sharma Senior Geomodeler -- http://mail.python.org/mailman/listinfo/python-list
Advise for numerical programming content (New python user)
Python Users, I am an average Fortran user. I am new to python and I am currently evaluating options and functionalities of numerical programming and related 2d and 3d graphic outputs with python. Kindly share your experience in scientific programming with python like how do you like it, comparison with Fortran and C++. Which version of python + numpy+scipy are compatible with each other or if any other numerical analysis package is available (I am working on windows environment.) Does graphic output like maps, histogram, crossplot, tornado charts is good enough with basic installation or needs some additional packages? Your feedback is valuable for me to start. Thanks & Regards Sachin **** Sachin Kumar Sharma Senior Geoscientist -- http://mail.python.org/mailman/listinfo/python-list
RE: Python use growing fast
Since this discussion is going on about the popularity of a programming language. I would like to know views regarding the best language for scientific programming especially in terms of user friendliness, resources available, graphics and robustness to handle large numerical and simulation problems. Thanks & regards Sachin **** Sachin Kumar Sharma Senior Geomodeler -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Octavian Rasnita Sent: Tuesday, January 11, 2011 3:38 PM To: [email protected] Subject: Re: Python use growing fast From: "Gerry Reno" > On 01/10/2011 08:31 PM, Katie T wrote: >> On Mon, Jan 10, 2011 at 10:29 PM, John Nagle wrote: >> >>> On 1/10/2011 1:02 PM, MRAB wrote: >>> >>>> On 10/01/2011 20:29, Dan Stromberg wrote: >>>> >>>>> I invite folks to check out Tiobe's Language Popularity Rankings: >>>>> >>>>> http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html >>>>> >>> That's somehow derived from web searches, not from any real data >>> source. Look how far down JavaScript is. >>> >> Any measure is arbitrary and subject to biases, what methodology would >> you prefer ? >> >> >> Katie >> > > Measuring the "Buzz" about a language is actually a pretty good way to > gauge its popularity. Well, not exactly. C and C++ are older than many other languages and probably many of the web pages that contain "programming C" are very old and don't reflect their current popularity. On the other hand, newer languages are more attractive for book publishers because they can sell more books about Ruby than about C, because for C there are already very many books written so there is a bigger intrest to promote the newer languages, not just because they are better, but because there are interests involved. Talking about interests, Java and DotNet are more popular than many other languages, but we all know why, and we also know why PHP has such a big success although it is a bad language, as we all know why Window has a bigger success than other operating systems... so the popularity contest is good, but for something else than we want to prove. A programming language popularity contest is like a beauty contest for finding the most intelligent girl. Octavian -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
