Re: How to split a list type array into float array?

2019-05-21 Thread Ervin Hegedüs
On Tue, May 21, 2019 at 03:38:43AM -0700, Madhavan Bomidi wrote: > Hi, > > I have the following list type data: > > [' 29.7963 29.6167 29.4371 29.2574 29.0778 28.8982 28.7185 > 28.5389 28.3593 28.1797 28. 27.8204 27.6408 27.4611 27.2815 > 27.1019 26.9223 2

Re: Querying MariaDB from python

2018-10-02 Thread Ervin Hegedüs
Hi Tony, On Tue, Oct 02, 2018 at 05:07:38PM +0100, Tony van der Hoff wrote: > On 02/10/18 16:47, Ervin Hegedüs wrote: > > hi, > > > > now rows will looks like this: > > ({'id':...,...},{'id':...,}...) > > Thanks Ervin, but: > >

Re: Querying MariaDB from python

2018-10-02 Thread Ervin Hegedüs
hi, On Tue, Oct 02, 2018 at 04:14:45PM +0100, Tony van der Hoff wrote: > I'm writing a database application, in python 3,5 under Debian9. > > My code: > >     def get_albums(self, parent_id = 0 ): >     cursor = self.cnx.cursor() cursor = self.cnx.cursor(pymysql.cursors.DictCursor

Re: Autotool - compile module for both Python 2 _and_ 3

2016-05-17 Thread Ervin Hegedüs
Hi Dirk, On Tue, May 17, 2016 at 09:13:02AM +0200, Dirk Bächle wrote: > Hi Ervin, > > On 16.05.2016 11:05, Ervin Hegedüs wrote: > >Hi All, > > > > > >there is a library, which written in C. I'ld like to use it from > >Python - from Python 2 _and_ 3

Autotool - compile module for both Python 2 _and_ 3

2016-05-16 Thread Ervin Hegedüs
Hi All, there is a library, which written in C. I'ld like to use it from Python - from Python 2 _and_ 3. I can make the autotools* files for Python 2 and Python 3, but only exclusively. I can't make it for both in same time. There is a macro for autotool, called ax_python_devel.m4. This macro u

Re: Testing whether the VPN is running?

2016-02-18 Thread Ervin Hegedüs
Hi Adam, On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: > I'd like to test (inside a python 3 program) whether the VPN is > running or not. The only thing I can think of so far is to use > subprocess to run the 'ifconfig' command, then check its output for > 'tun0'. Is there a better

Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hi Denis, On Fri, Nov 20, 2015 at 05:08:21PM -, Denis McMahon wrote: > On Fri, 20 Nov 2015 16:53:47 +0100, Peter Otten wrote: > > > Ervin Hegedüs wrote: > > >> Python has a good string formatter, eg. I can do this: > > Or even: > > >>> s =

Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hi Peter, On Fri, Nov 20, 2015 at 04:53:47PM +0100, Peter Otten wrote: > Ervin Hegedüs wrote: > > > Python has a good string formatter, eg. I can do this: > > > > s = "{who} likes {what}" > > d = {'who': "Adam", 'what&

Re: String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hello Chris, On Sat, Nov 21, 2015 at 02:06:11AM +1100, Chris Angelico wrote: > On Sat, Nov 21, 2015 at 1:52 AM, Ervin Hegedüs wrote: > > Python has a good string formatter, eg. I can do this: > > > > s = "{who} likes {what}" > > d = {'who': "Ad

String format - resolve placeholders names

2015-11-20 Thread Ervin Hegedüs
Hi, Python has a good string formatter, eg. I can do this: s = "{who} likes {what}" d = {'who': "Adam", 'what': "ants"} s.format(**d) result: 'Adam likes ants' Is it possible, and if yes, how to resolve the placeholders names in string? There is a know method: d1 = {'who1': "Adam", 'what1': "

Re: Extended functions in embedded code

2015-10-15 Thread Ervin Hegedüs
many thanks for all help. Cheers, a. ps: after I've done, I realized, that will not good for me :). Nevermind, this was a funny work. On Tue, Oct 13, 2015 at 1:36 PM, Ervin Hegedüs wrote: > Hello there, > > I'm interesting for the embeding of Python code - the examples and d

Re: Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
On Wed, Oct 14, 2015 at 12:02:36AM +0200, Laura Creighton wrote: > In a message of Tue, 13 Oct 2015 22:28:54 +0200, Ervin Hegedüs writes: > >Hi Chris, > > > >what I misses: currently I'm using Python 2.7. > > > >On Wed, Oct 14, 2015 at

Re: Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
Hi, On Tue, Oct 13, 2015 at 08:55:42AM -0700, Emile van Sebille wrote: > On 10/13/2015 8:29 AM, Ervin Hegedüs wrote: > >Hi Chris, > > > >On Wed, Oct 14, 2015 at 02:05:43AM +1100, Chris Angelico wrote: > > >>Sounds to me like the easiest way would be to inject int

Re: Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
Hi Chris, what I misses: currently I'm using Python 2.7. On Wed, Oct 14, 2015 at 02:48:57AM +1100, Chris Angelico wrote: > On Wed, Oct 14, 2015 at 2:29 AM, Ervin Hegedüs wrote: > >> > >> Sounds to me like the easiest way would be to inject into the > >> bui

Re: Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
Hi Chris, On Wed, Oct 14, 2015 at 02:05:43AM +1100, Chris Angelico wrote: > On Wed, Oct 14, 2015 at 1:59 AM, Ervin Hegedüs wrote: > > no, I have filesystem. I help to contribute a software, which had > > written in C. The configuration schema is very simple, there are > >

Re: Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
Hi, On Tue, Oct 13, 2015 at 02:51:21PM +0200, Laura Creighton wrote: > Are you looking for this:? > https://docs.python.org/3.5/library/runpy.html I think I'm not - I'm afraid, the runpy modul wasn't developed for me, for this reason. > or maybe this:? > https://docs.python.org/3.5/library/impo

Extended functions in embedded code

2015-10-13 Thread Ervin Hegedüs
Hello there, I'm interesting for the embeding of Python code - the examples and docs are very helpfully. The main code, which embeds the Python interpreter, had written in C. There are several functions, what I have to use in embedded (Python) code, so I must to write them as Python extension. Th

Re: function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Ervin Hegedüs
hi, On Sat, Oct 03, 2015 at 10:40:57AM -0700, Ronald Cosentino wrote: > def funA(x,y,z): > return (x+y) * z > def funB(x,y): > return(x-y) > print(funA(4,funB(2,3), funB(3,2))) > > the answer is 3. I don't know how it works. it's simple: - there is a "composition of functions", generall

Re: Python xlrd

2015-05-02 Thread Ervin Hegedüs
hi, On Sat, May 02, 2015 at 03:12:46PM -0700, lbertolotti via Python-list wrote: > Ubuntu terminal gives me: > > import xlrd > > I get "ImportError: No module named xlrd" > > Any ideas? I installed it by: > > sudo apt-get install python-xlrd what's the answers of your system for these questio

Re: Lockfile hanling

2015-03-31 Thread Ervin Hegedüs
Hi Matthew, On Tue, Mar 31, 2015 at 11:50:06AM -0400, Matthew Ruffalo wrote: > On 2015-03-31 10:50, Ervin Hegedüs wrote: > > there is an app, written in Python, which stores few bytes of > > datas in a single file. The application uses threads. Every > > thread can modify t

Re: Lockfile hanling

2015-03-31 Thread Ervin Hegedüs
Hi Skip, On Tue, Mar 31, 2015 at 10:19:27AM -0500, Skip Montanaro wrote: > > sorry - at the end of the function there is a close() method to a > > file, after the thread passes the modifications: > > > > try: > > os.remove(self.lockfile) > > except: > > syslog.syslog(syslog

Re: Lockfile hanling

2015-03-31 Thread Ervin Hegedüs
Hi Skip, thanks for the reply, On Tue, Mar 31, 2015 at 09:55:57AM -0500, Skip Montanaro wrote: > On Tue, Mar 31, 2015 at 9:50 AM, Ervin Hegedüs wrote: > > After few weeks the process > > reaches the number if max fd's. > > > > How can I prevent or avoid this

Lockfile hanling

2015-03-31 Thread Ervin Hegedüs
Hello, there is an app, written in Python, which stores few bytes of datas in a single file. The application uses threads. Every thread can modify the file, but only one at a time. I'm using a lock file to prevent the multiple access. Here is the lock method: while True: try: f

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi Chris, On Sat, Jan 03, 2015 at 01:01:31AM +1100, Chris Angelico wrote: > On Sat, Jan 3, 2015 at 12:51 AM, Ervin Hegedüs wrote: > > it may be at the concrete example in OP is better the glob - but > > I think in most cases the re modul gives more flexibility, I mean > &g

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 11:59:17PM +1100, Chris Angelico wrote: > On Fri, Jan 2, 2015 at 11:36 PM, Ervin Hegedüs wrote: > >> And worse, the given re would delete a file named "uni" which doesn't > >> sound ANYTHING like what the OP wanted :-) > >

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 05:35:52AM -0600, Tim Chase wrote: > On 2015-01-02 21:21, Cameron Simpson wrote: > > >def unlinkFiles(): > > >dirname = "/path/to/dir" > > >for f in os.listdir(dirname): > > >if re.match("^unix*$", f): > > >os.remove(os.path.join(dirname, f))

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 09:21:53PM +1100, Cameron Simpson wrote: > On 02Jan2015 10:00, Ervin Hegedüs wrote: > >On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: > >>I have a function I'm writing to delete wildcarded files in a directory. > &g

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: > Hi Everyone, > > I have a function I'm writing to delete wildcarded files in a directory. > I tried this: > > def unlinkFiles(): > os.remove("/home/anthony/backup/unix*") > > This doesn't seem to work because it's a wi

Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Ervin Hegedüs
Hi, On Wed, Dec 17, 2014 at 08:16:23AM -0800, radzh...@gmail.com wrote: > smtplib.SMTPRecipientsRefused: {'aahlin!@gmail.com': (550, 'restricted > characters in address')} > > As in this question, the answer has reference to RFCs that spec it out, and > state that exclamations are ok, so why is

Re: Thread-ID - how much could be?

2014-09-13 Thread Ervin Hegedüs
On Sat, Sep 13, 2014 at 12:09:28PM +0200, Martin Skjöldebrand wrote: > Unfortunately we will never know 😢 hehe :), joke of the day :) thanks, a. -- I � UTF-8 -- https://mail.python.org/mailman/listinfo/python-list

Re: Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hi Steven, On Fri, Sep 12, 2014 at 11:29:56AM +1000, Steven D'Aprano wrote: > import sys > print sys.maxint > > 9223372036854775807 > > > > the couter could be 9223372036854775807? > > > > And after? :) > > Suppose you somehow managed to create 9223372036854775807 threads. If your > c

Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Chris, On Fri, Sep 12, 2014 at 12:29:27PM +1000, Chris Angelico wrote: > On Fri, Sep 12, 2014 at 12:03 PM, Michael Torrie wrote: > > > > Any executable file can be turned into a daemon service with systemd > > (whether or not it forks itself into the background). Thus any python > > script ca

Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Michael, On Thu, Sep 11, 2014 at 08:03:54PM -0600, Michael Torrie wrote: > >> What I want is to have this startup, after my board has it’s networking > >> layer up and running (and hopefully a valid ip address by then), and to > >> just keep running forever > > > > may be you think about the

Re: Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hi Peter, thanks for the reply, On Thu, Sep 11, 2014 at 09:48:18PM +0200, Peter Otten wrote: > Ervin Hegedüs wrote: > > > Exception in thread Thread-82: > > ... > > My question is: how much thread ID could be totally? Is there any > > maximum number? And if the thr

Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Travis, On Thu, Sep 11, 2014 at 02:06:48PM -0700, Travis Griggs wrote: > > On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick > wrote: > > > Depends what you want. > > Mine is not a web service. My main.py looks like this: > > #!/usr/bin/env python3 > > import cycle > import pushTel

Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hello, I've made a long-time running daemon, which uses threads. Looks like that works perfectly, now I'm looking at the exceptions :). In the log, I found an interesting message: Exception in thread Thread-82: ... The main function allows 2 thread to run simultaniously, and if the thread finis

Re: Thread terminate

2014-08-28 Thread Ervin Hegedüs
Hi Chris, On Thu, Aug 28, 2014 at 12:34:18PM -0700, Chris Kaynor wrote: > On Thu, Aug 28, 2014 at 11:39 AM, Ervin Hegedüs wrote: > > > > now the code looks like this: > > > > def run(self): > > try: > > connect_to_db() > > excep

Re: Thread terminate

2014-08-28 Thread Ervin Hegedüs
Hi Chris, thanks for you answer, On Thu, Aug 28, 2014 at 09:23:24AM -0700, Chris Kaynor wrote: > On Thu, Aug 28, 2014 at 1:52 AM, Ervin Hegedüs wrote: > > > > > In your case, you may want to just handle the exceptions inside the > > > thread's run() function d

Re: Thread terminate

2014-08-28 Thread Ervin Hegedüs
Hi Marko, On Thu, Aug 28, 2014 at 12:02:29PM +0300, Marko Rauhamaa wrote: > Ervin Hegedüs : > > > at this time there is only one thread, as you wrote. I just try > > to prepare it to higher load, when one thread will not enough... > > Threads are a necessary evil wh

Re: Thread terminate

2014-08-28 Thread Ervin Hegedüs
Hi Chris, thanks for the reply, On Wed, Aug 27, 2014 at 12:26:48PM -0700, Chris Kaynor wrote: > On Wed, Aug 27, 2014 at 11:55 AM, Ervin Hegedüs wrote: > > > what's the correct way to terminate a thread by itself? > > > > To terminate the thread, the run function

Thread terminate

2014-08-27 Thread Ervin Hegedüs
Hi, what's the correct way to terminate a thread by itself? I mean: class MyThread(threading.Thread): def __init__(self, queueitem): threading.Thread.__init__(self) ... def run(self): """pseudo code below""" try: self.connect_to_database()

Re: Problems compiling Python 3.4 on Ubuntu

2014-02-03 Thread Ervin Hegedüs
Hello, On Mon, Feb 03, 2014 at 02:50:15AM -0800, cool-RR wrote: > Hi, > > I'm trying to install Python 3.4b3 on Ubuntu. Since compilation seems to be > the only way, I'm trying that. > > I downloaded the source, I changed Setup.dist to have this: > > SSL=/usr > _ssl _ssl.c \ >

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread Ervin Hegedüs
Hello, On Sat, Jan 25, 2014 at 02:02:15AM -0800, justinpmull...@gmail.com wrote: > My son is learning Python and I know nothing about computers. :) > He's written a simple calculator program that doesn't work. For the life of > me, I can't see why. > Any help gratefully received. Here's his co

Re: Bytes indexing returns an int

2014-01-07 Thread Ervin Hegedüs
hi, On Tue, Jan 07, 2014 at 10:13:29PM +1100, Steven D'Aprano wrote: > Does anyone know what the rationale behind making byte-string indexing > return an int rather than a byte-string of length one? > > That is, given b = b'xyz', b[1] returns 121 rather than b'y'. > > This is especially surprisi

Re: Python, mySQL and password

2013-12-16 Thread Ervin Hegedüs
Hello Peter, On Mon, Dec 16, 2013 at 12:38:33PM +0100, Peter Otten wrote: > Ervin Hegedüs wrote: > > > dsn['passwd'] = raw_input("Enter password for %s: " % (dsn['user'])) > > [...] > > but at this way the password what you type will showin

Re: Python, mySQL and password

2013-12-16 Thread Ervin Hegedüs
Hello, On Mon, Dec 16, 2013 at 02:55:29AM -0800, Igor Korot wrote: > Hi, ALL, > Is there a way to make python script that connects to mySQL DB ask for > a password on the: > > conn = mdb.connect(host, user) > > line. > The host variable is "localhost" and the user variable is "root" (for > devel

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Ervin Hegedüs
hello, > #!/usr/bin/env python > > """ > A simple echo client > """ > import socket as socket_mod > import bufsock as bufsock_mod [...] > Traceback (most recent call last): > File "./buftest.py", line 11, in > socket = socket_mod.socket(socket.AF_INET, socket.SOCK_STREAM) > NameError: name

Re: TypeError: not all arguments converted during string formatting

2013-12-13 Thread Ervin Hegedüs
hello, On Fri, Dec 13, 2013 at 05:18:59AM -0800, Jai wrote: > sql = """insert into > fashion(GENDER,links,category,item_content,price,seller) \ > VAlUES('%s','%s','%s','%s','%s','s')""" may be you miss a "%" sign? > query = query %

Re: urllib2 timeout issue

2013-10-17 Thread Ervin Hegedüs
Hello, On Thu, Oct 17, 2013 at 03:34:05PM +0200, Jérôme wrote: > Hi. > > Thank you all for your answers. > > -- > Context: > > The problem I want to address is the code being stuck too long when the > network is down. > > I'm working on a softwar

Re: DNS query against a specific server.

2013-09-30 Thread Ervin Hegedüs
Hello, On Mon, Sep 30, 2013 at 04:42:29AM -0700, Michel Albert wrote: > Hi, > > ``socket.gethostbyname`` sends the DNS resolution query to the DNS server > specified by the OS. Is there an easy way to send a query to a *different* > server? > > I see that twisted.names allows you to do this, b

Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 07:22:50PM +1000, Ben Finney wrote: > Ervin Hegedüs writes: > > > Hello, > > > > On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote: > > > for row in cur.fetchall(): > > > > and what if in body of itera

Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 05:35:30PM +1000, Ben Finney wrote: > Venkat Addala writes: > > > rows = cur.fetchall() > > for row in rows: > > You never use ‘rows’ for anything else, so you may as well forget it and > just iterate directly over the return value:: > > for row in cur.fe

Re: MySQLdb Help

2013-09-17 Thread Ervin Hegedüs
Hello, On Tue, Sep 17, 2013 at 12:43:20PM +0530, Venkat Addala wrote: > Hi all, > > > I'm new to python, i am connecting mysql database with python. now i want > to do sanitation on the database, like to remove "\n", extra spaces blah > blah.. and update it back to mysql database. i was trying

Re: detect key conflict in a JSON file

2013-05-29 Thread Ervin Hegedüs
Hello, On Wed, May 29, 2013 at 03:41:50PM +0200, Jabba Laci wrote: > > The real answer here is that JSON is probably not the best choice for > > large files that get hand-edited. For data that you intend to hand-edit > > a lot, YAML might be a better choice. > > > >> Currently the value of the se

Re: send email with bcc

2012-11-30 Thread Ervin Hegedüs
Hello, On Fri, Nov 30, 2012 at 12:25:37PM -0800, Ed wrote: > > # Send the email > smtp.sendmail(sender, [to] + bcc, msg.as_string()) > > The above generates the following error: > Traceback (most recent call last): > File "/opt/batch/ebtest/example4.py", line 46, in > smtp.sendmail(sender

Re: Daemon loses __file__ reference after a while.

2012-07-24 Thread Ervin Hegedüs
hello, On Tue, Jul 24, 2012 at 04:48:42AM -0700, ivdn...@gmail.com wrote: > Hello, > > I have a daemon process that runs for a considerable amount of time (weeks on > end) without any problems. At some point I start getting the exception: > > Exception info: Traceback (most recent call last): >

Re: how do i merge two sequence

2012-04-18 Thread Ervin Hegedüs
hi, On Wed, Apr 18, 2012 at 10:41:00PM +0200, Peter Otten wrote: > Python Email wrote: > > > how do i merge two seqs alernative; > > > > ("xyz", "7890") > > output: x7y8z90 > > >>> import itertools > >>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890", > fillvalue="")) > 'x7y8z90'

Re: Looking PDF module

2011-06-24 Thread Ervin Hegedüs
hello, On Fri, Jun 24, 2011 at 09:59:17AM -0700, Cameron Laird wrote: > Hegedüs Ervin, it's quite likely that ReportLab will be a good > technical fit > for you. it's a good news :) > Are you in a position to pay licensing fees for advanced > features? no :( > Do you have any requirements to *m

Re: Need your help

2011-04-28 Thread Ervin Hegedüs
hello, On Thu, Apr 28, 2011 at 01:20:16PM +0200, Ervin Hegedüs wrote: > #!/usr/bin/python > > import a > import b > > import sys > import StringIO > > output = StringIO.StringIO() > > def c(): > # save default stdout > tout = sys.stdout >

Re: Need your help

2011-04-28 Thread Ervin Hegedüs
hello, > Here I need some help. > > #encoding="utf-8" > #moudle a.py > def a(): > print " function a!" > > #encoding="utf-8" > #moudle b.py > def b(): > print " function b!" > > > #encoding="utf-8" > #moudle c.py > import a > import b > def c(): > a.a() > b.b() > > > Here in func

Re: ElementTree XML parsing problem

2011-04-27 Thread Ervin Hegedüs
hello, On Thu, Apr 28, 2011 at 07:57:28AM +0200, Stefan Behnel wrote: > >So, I started change the codepage mark of xml: > > > > - same result > > - same result > > - same result > > You probably changed this in an editor that supports XML and thus > saves the file in the declared encoding. no

Py_INCREF() incomprehension

2011-04-26 Thread Ervin Hegedüs
Hello Python users, I'm working on a Python module in C - that's a cryptographic module, which uses a 3rd-party lib from a provider (a bank). This module will encrypt and decrypt the messages for the provider web service. Here is a part of source: static PyObject* mycrypt_encrypt(PyObject *self,