AW: Unrecognised Arguments

2018-12-02 Thread Lutz Horn
Hi, you use the `--lang` option wrongly. Fails: $ twitterscraper -bd 2015-01-01 -ed 2016-01-01 –lang en usage: twitterscraper [-h] [-o OUTPUT] [-l LIMIT] [-a] [-c] [-u] [--lang LANG] [-d] [-bd] [-ed] [-p] query twitterscraper: error: unrecognized argume

Re: AES Encryption/Decryption

2018-11-02 Thread Lutz Horn
On Fri, Nov 02, 2018 at 07:42:24AM -0700, Jeff M wrote: > Python newbie here, looking for code samples for encrypting and > decrypting functions, using AES. See lots of stuff on the interwebs, > but lots of comments back an forth about bugs, or implemented > incorrect, etc... > > I need to encryp

Re: Python Enhancement Proposal for List methods

2018-10-22 Thread Lutz Horn
On Sun, Oct 21, 2018 at 06:06:40PM +0530, Siva Sukumar Reddy wrote: > 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the > occurrences of an element in the list instead of writing a new list > comprehension in place. Try this: >>> l = [1, 3, 4, 5, 6, 5, 4, 3, 2, 1] >>> def

AW: how to replace line on particular line in file[no need to write it back whole file again]

2018-10-11 Thread Lutz Horn
Try something like this: ``` import sys def replace(lineno, replacement): for i, line in enumerate(sys.stdin.readlines()): if i == lineno: line = replacement print(line.strip()) replace(2, "REPLACEMENT") ``` Von: Python-li

Re: P = (2^N) - Q

2018-09-24 Thread Lutz Horn
Hi, > If P is the set of primes, how do I write a program ... 1. Do you plan to write this in Python? 2. What have you tried so far? 3. Does it work? Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: round

2018-06-07 Thread Lutz Horn
M = np.array([[0, 9],[2, 7]], dtype=int) np.linalg.det(M) -18.004 round(np.linalg.det(M)) np.linalg.det(M) has type numpy.float64, not float. Try this: round(float(np.linalg.det(M))) -18 Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: help me ?

2018-02-26 Thread Lutz Horn
Define 2 lists. ... [...] Help me ! Sounds like homework. Have you tried anything? Does it work? -- https://mail.python.org/mailman/listinfo/python-list

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-27 Thread Lutz Horn
On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote: > from packaging import version as pack_version > ImportError: No module named packaging > > I googled it and I have found so many suggestions regarding updating > 'pip' and installing python-setuptools but all of these did not fix > t

Re: Python noob having a little trouble with strings

2017-10-27 Thread Lutz Horn
On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote: > Hi Bob, thanks for responding. I'm not sure where to do so, my > professor had us download Pycharm for mac's which uses python 2.6 The code from your question is not specific to Python 2 or 3. Just try it in the Python install

Re: little help in homework required

2017-06-16 Thread Lutz Horn
Hi, TypeError: a bytes-like object is required, not 'str' ... mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n') Here you must encode the str as bytes: mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n'.encode("UTF-8")) The actual encoding does not

Re: help with an error msg please

2017-05-14 Thread Lutz Horn
> $ PYTHONPATH= python except > Traceback (most recent call last): > File "except", line 7, in > except getopt.error, msg: > AttributeError: 'module' object has no attribute 'error' > > > The program is: > > $ cat except > #!/usr/bin/env python > > import getopt > > try: > opts, a

Re: [GIS] Keeping only POIs X kms from a trace?

2017-05-08 Thread Lutz Horn
Problem is, files are only country-size, so the number of waypoints is overwhelming (Here's the UK for instance**). How many is 'overwhelming'? Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: packaging python code

2017-05-08 Thread Lutz Horn
Is there any way to pack my .py with all required libraries and create a self running package? Take a look at PyInstaller: * http://www.pyinstaller.org/ * https://pyinstaller.readthedocs.io/en/stable/ Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: Practice Python

2017-05-08 Thread Lutz Horn
Python - Exercise 5 Do you want us to solve these problems for you? The answers here: https://www.youtube.com/watch?v=nwHPM9WNyw8&t=36s A strange way to publish code. Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: Who are the "spacists"?

2017-03-18 Thread Lutz Horn
Am 18.03.17 um 16:18 schrieb Mikhail V: > On 18 March 2017 at 05:02, Ben Finney > wrote: >> Mikhail V writes: >> >>> I think it would be a salvation to forbid spaces for indentation, >>> did such attemps take place? >> >> Feel free to start your own discussion forum for your new >> programming

Re: How to add a built-in library in pyhton

2017-03-17 Thread Lutz Horn
Am 17.03.2017 05:08 schrieb chenchao: I use python2.7.10 and want to add a c language library in python. So how can i built it as a built-in module in python? Why do you want to build it as a built-in module? Why not a simple module as described on https://docs.python.org/2/extending/index.

Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread Lutz Horn
Some Python users have told me that isn't a good idea, but without any specifics. We don't know *why* those people told you not to use these modules. We also don't know your use case. So it is very hard to advise you. Lutz -- https://mail.python.org/mailman/listinfo/python-list

Re: integer's methods

2016-08-18 Thread Lutz Horn
CPython's lexical analyzer can't handle a dot after an integer literal so you must add a space in between "123" and ".". Ok, this works: >>> 123 .bit_length() 7 But it looks really strange. Let's use a variable instead of an integer literal. Lutz -- https://mail.python.org/mailman/listinfo/

Re: integer's methods

2016-08-18 Thread Lutz Horn
Am 08/18/2016 um 02:58 PM schrieb ast: 123.bit_length() SyntaxError: invalid syntax You are not calling a method here because the parser is not finished. The parser thinks you want to write a float with the value 1.bit_length which is not valid Python syntax. Lutz -- https://mail.python.or

Re: --> Running shell script with python

2016-08-18 Thread Lutz Horn
Tell me, do you know how can i send CTRl+C command from python to terminate this external shell script ? os.system[1] is not an asynchronous function. It returns as soon as the called command terminates, not earlier. If you want to execute a command in a subprocess, use subprocess.Popen[2].

Re: Call for Assistance

2016-08-09 Thread Lutz Horn
Regarding the CC-BY-NC-SA license: Am 09.08.16 um 17:42 schrieb Reto Brunner: > What on earth isn't "free" enough about [...] > It is even a viral (copy left) licence, so even a fsf member should > be happy The FSF considers the CC-BY-NC to *not* be a license for free documentation[1]: > This l

Re: Question regarding stdlib distutils strtobool behavior

2016-08-09 Thread Lutz Horn
Am 08/09/2016 um 03:22 PM schrieb Joseph Bane: It recently came to my attention that the strtobool function in the standard library doesn't return Python native boolean values, but rather returns integer 0 or 1: In boolean context, 1 is True and 0 is False. So you should be able to use the res

Re: Call for Assistance

2016-08-09 Thread Lutz Horn
Am 08/09/2016 um 03:52 AM schrieb Charles Ross: The book is being hosted at https://github.com/chivalry/meta-python CC-BY-NC-SA is not a license for free (as in speech) content. Is that what you want? Lutz -- https://emailselfdefense.fsf.org/ -- https://mail.python.org/mailman/listinfo/python

Re: Float

2016-07-29 Thread Lutz Horn
Am 07/29/2016 um 11:44 AM schrieb Cai Gengyang: Can someone explain in layman's terms what "float" means ? The Python builtin float[1] > Return a floating point number constructed from a number or string x. A floating point number[2] is number that is not an integer (and not a complex number

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-28 Thread Lutz Horn
Hi, Am 07/28/2016 um 03:48 PM schrieb Larry Martell: Thanks, but I have abandoned using pickle. I am now converting my objects to JSON, writing them to files, passing the file names to the process and reading them in and converting them back to objects there. In addition to that working, it make

Re: Can Python learn from Perl? Perl 5 can now run Perl 6 code

2016-07-28 Thread Lutz Horn
Hi, Am 07/28/2016 um 09:21 AM schrieb Steven D'Aprano: But Perl has a feature that if you tell it to run a file with a hashbang line, it will call the given executable to run that file. That's now been improved to recognise Perl6 as an external executable, instead of trying to run it as Perl 5 c

RE: Question about official API

2016-02-05 Thread Lutz Horn
Hi, > What is the rule for knowing if something is part of the official API? Look into https://docs.python.org/3/library/ Lutz -- https://mail.python.org/mailman/listinfo/python-list

RE: eval( 'import math' )

2016-02-04 Thread Lutz Horn
Hi, >I just discovered that function does not necessarily take the >string input and transfer it to a command to execute. Can you please show us the code you try to execute and tells what result you expect? Lutz -- https://mail.python.org/ma

Re: Python IM server

2014-03-31 Thread Lutz Horn
Hi, I want to develop a instant message server, simply has user and group entity. Is there any better existing open-source one? Take a look at XMPP[0]. There are some Python libraries[1]. [0] https://en.wikipedia.org/wiki/XMPP [1] http://xmpp.org/xmpp-software/libraries/ -- Opt out of gl

Re: Loop Question

2013-06-25 Thread Lutz Horn
Hi, Am 24.06.2013 14:12 schrieb christheco...@gmail.com: username=raw_input("Please enter your username: ") password=raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo": print "Login Successful" else: print "Please try again" while not usernam

Re: List problem

2012-12-02 Thread Lutz Horn
Him Am 02.12.2012 um 16:03 schrieb subhabangal...@gmail.com: > I have a list of the following pattern, > > [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), > ('Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'), ('Suhag', > 'NNP'), ('briefed', 'VBD'), ('th

Re: trying to create simple py script

2012-08-09 Thread Lutz Horn
Hi Smaran, Am Do, 9. Aug 2012, um 23:52, schrieb Smaran Harihar: > I am trying to create a simple cgi-script to receive a Ajax > call, manipulate the string received and send it back as JSON. I can recommend bottle. The following example manipulates a JSON request body and returns it. That is *mu

Re: how to get my character?

2012-01-26 Thread Lutz Horn
Hi, On Thu, 26 Jan 2012 20:52:48 +0800, contro opinion wrote: how can i get "你好" from 'xc4xe3xbaxc3' ? Please share any results you get from http://stackoverflow.com/questions/9018303/how-to-get-my-character with python-list. Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: Geodetic functions library GeoDLL 32 Bit and 64 Bit

2011-07-20 Thread Lutz Horn
Hi, do you think this is the right place to advertise proprietary and commercial software? Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: reading from pipe

2010-01-25 Thread Lutz Horn
Hi, Richard Lamboj schrieb: > is there any solution to catch if a pipe has closed? Maybe the signal modul? Since sys.stdin is a file object, you can use sys.stdin.closed to check if it has been closed. Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: whitespace in xml output

2009-12-08 Thread Lutz Horn
Hi, wadi wadi wrote: > I am creating some xml output using minidom and saving it to a file > using doc.writexml() Could you please add some code of *how* you add the content "bill catman" to the "Author" element? It seems as if whitespace is an issue here. Lutz -- http://mail.python.org/mailma

Re: How to test urllib|urllib2-using code?

2009-11-04 Thread Lutz Horn
Hi, kj wrote: > I want to write some tests for code that uses both urllib and > urllib2. Take a look at the discussion under the title "How can one mock/stub python module like urllib" at stackoverflow: http://stackoverflow.com/questions/295438/how-can-one-mock-stub-python-module-like-urllib Lu

Re: How to print zero-padded floating point numbers in python 2.6.1

2009-11-04 Thread Lutz Horn
Lorenzo Di Gregorio schrieb: > print '%2.2F' % 3.5 > 3.50 > print '%02.2F' % 3.5 > 3.50 > > How can I get print (in a simple way) to print 03.50? print '%05.2F' % 3.5 Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Lutz Horn
Hi, Nick schrieb: > I've seen a lot of posts on this problem, but none seems to help. Could you please post a sample input file and the exact error message? Thanks Lutz -- Strike Out ⇒ http://www.fourmilab.ch/documents/strikeout -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with variables assigned to variables???

2008-04-29 Thread Lutz Horn
Hi, 2008/4/30 <[EMAIL PROTECTED]>: > mylist = ('name1', 'name2', 'name3') > > I also assigned variables for each SQL expression: > name1 = "\"field_a\" LIKE '021'" > name2 = "\"field_a\" LIKE '031'" > name3 = "\"field_a\" LIKE '041'" > my intended output is: > name1.shp "field_a LIKE '021

Re: sed to python: replace Q

2008-04-29 Thread Lutz Horn
Hi, 2008/4/30 Raymond <[EMAIL PROTECTED]>: > For some reason I'm unable to grok Python's string.replace() function. replace() does not work with regular expressions. > Is there a decent description of string.replace() somewhere? Use re.sub(). >>> import re >>> line = "date process text [ip] m

Re: computing with characters

2008-04-29 Thread Lutz Horn
Hi, 2008/4/30 Gary Herron <[EMAIL PROTECTED]>: > SL wrote: > > How can I compute with the integer values of characters in python? > > Like 'a' + 1 equals 'b' etc > > You can get an integer value from a character with the ord() function. So just for completion, the solution is: >>> chr(ord('a')

Re: Python help for a C++ programmer

2008-01-16 Thread Lutz Horn
Hi, On Wed, 16 Jan 2008 06:23:10 -0800 (PST), "mlimber" <[EMAIL PROTECTED]> said: > I'm writing a text processing program to process some survey results. > I'm familiar with C++ and could write it in that, but I thought I'd > try out Python. I've got a handle on the file I/O and regular > expressi

Re: plz help how to print python variable using os.system()

2008-01-16 Thread Lutz Horn
Hi, On Wed, 16 Jan 2008 05:29:08 -0800 (PST), [EMAIL PROTECTED] said: > var = "/home/anonymous" > os.system("echo $var) os.system("echo %s" % var) Lutz -- GnuPG Key: 1024D/6EBDA359 1999-09-20 Key fingerprint = 438D 31FC 9300 CED0 1CDE A19D CD0F 9CA2 6EBD A359 http://dev-random.

Re: class C: vs class C(object):

2007-07-19 Thread Lutz Horn
Hi, On Thu, 19 Jul 2007 09:40:24 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > there's absolutely no reason to use it no more since "new-style" classes > can do anything "Classic" classes did and much more. IOW, don't even > bother with old-style classes. Just for the records: the

Re: CSV Issues

2007-07-18 Thread Lutz Horn
Hi, On Thu, 19 Jul 2007 06:59:24 +0200, Rohan <[EMAIL PROTECTED]> wrote: > When I run the script for the second time after a certain period of > time the results should appear next to the results of the last run, > I'm unable to make a new column when the script is run after the first > time. > Id

Re: SOAPpy and http authentication

2005-08-02 Thread Lutz Horn
On 2005-08-02, Odd-R. <[EMAIL PROTECTED]> wrote: > from SOAPpy import WSDL > from SOAPpy import URLopener > url= ' http://someserver/somewebservice > url1 = URLopener.URLopener(username='user',passwd='pass') > server=WSDL.Proxy(url1.open(url)) Is it possible to call WSDL.Proxy with a String? Then

Re: what is __init__.py used for?

2005-07-05 Thread Lutz Horn
* [EMAIL PROTECTED]: > root\ > system1\ > __init__.py > utilities.py > main.py > other.py ... >I was wonderring ... what is the __init__.py used for ? >This question may seems to be stupid for an expert. The __init__.py is needed for Python to recognize

Re: Simple XML-to-Python conversion

2005-03-17 Thread Lutz Horn
[EMAIL PROTECTED] schrieb: I've been searching high and low for a way to simply convert a small XML configuration file to Python data structures. Take a look at Amara (http://uche.ogbuji.net/tech/4Suite/amara/). Lutz -- pub 1024D/6EBDA359 1999-09-20 Lutz Horn <[EMAIL PROTECTED]> Key

Re: Web framework

2005-03-10 Thread Lutz Horn
Chris <[EMAIL PROTECTED]> wrote: > Does CherryPy require a python installation on the client side? No, it only sends HTML-pages and other media to the client's browser. -- http://mail.python.org/mailman/listinfo/python-list