Re: PyCA cryptography 2.3 released

2018-07-18 Thread Hans-Peter Jansen
Hi Paul, you have a version mismatch in subject and text. Cheers, Pete On Mittwoch, 18. Juli 2018 05:19:27 Paul Kehrer wrote: > PyCA cryptography 2.2.2 has been released to PyPI. cryptography includes > both high level recipes and low level interfaces to common cryptographic > algorithms such as

python not working

2018-01-29 Thread Abbas Hans
it shows thepythonw.exe system error: The program can't start because api-ms-win-crt-runtime-|1-1-0.dll is missing from your computer. try reinstalling the program to fix this problem. I reinstall it many times try to repair it is not working -- https://mail.python.org/mailman/listinfo/pyt

Wichtig für Maximus

2017-05-15 Thread Hans-Georg Joepgen
https://www.heise.de/newsticker/meldung/WannaCry-Microsoft-liefert-Sicherheits-Patches-fuer-veraltete-Windows-Versionen-3713417.html -- https://mail.python.org/mailman/listinfo/python-list

Re: keyrings.cryptfile released on github

2017-03-13 Thread Hans-Peter Jansen
On Dienstag, 14. März 2017 00:33:34 Hans-Peter Jansen wrote: > > I plan to add authenticated service and username support via associated data > as well (that protects against tampering with these values). Done. > Cheers, > Pete -- https://mail.python.org/mailman/listinfo/python-list

Re: keyrings.cryptfile released on github

2017-03-13 Thread Hans-Peter Jansen
On Freitag, 10. März 2017 13:31:41 Paul Rubin wrote: > Hans-Peter Jansen writes: > > [1] http://web.cs.ucdavis.edu/~rogaway/ocb/license.htm > > Oh that's interesting, he's expanded the free licenses. Still though, > while OCB is very clever and it was important as t

Re: keyrings.cryptfile released on github

2017-03-10 Thread Hans-Peter Jansen
On Donnerstag, 9. März 2017 23:09:09 ng0 wrote: > Hans-Peter Jansen transcribed 3.8K bytes: > > Hi, > > > > since the PyCrypto ML is dead, I'm looking for advise/feedback from some > > cryptography aware people. > > > > I've released a keyring co

keyrings.cryptfile released on github

2017-03-09 Thread Hans-Peter Jansen
Hi, since the PyCrypto ML is dead, I'm looking for advise/feedback from some cryptography aware people. I've released a keyring companion package today: https://github.com/frispete/keyrings.cryptfile Its primary purpose is a decent encrypted file backend for python keyrings. As such, it

Re: ANN: psutil 5.1.0 with hardware sensors released

2017-02-02 Thread Hans-Peter Jansen
On Mittwoch, 1. Februar 2017 21:54:06 Giampaolo Rodola' wrote: > Hello all, > I'm glad to announce the release of psutil 5.1.1: ^ Guess, you meant to say 5.1.0 here, or probably your time machine broke ;) Cheers, Pete -- https://mail.python.org/ma

Re: Referencing section name by interpolation in ConfigParser

2017-01-27 Thread Hans-Peter Jansen
On Mittwoch, 25. Januar 2017 10:01:56 Peter Otten wrote: > Hans-Peter Jansen wrote: > > I would like to use a interpolated section name, e.g.: > > > > [Section] > > secref: %{section}s/whatever > > > > should result in: > >>>> config['S

Referencing section name by interpolation in ConfigParser

2017-01-24 Thread Hans-Peter Jansen
Hi, I would like to use a interpolated section name, e.g.: [Section] secref: %{section}s/whatever should result in: >>> config['Section']['secref'] 'Section/whatever' Any idea anybody, how to archive this with minimum fuzz? Thanks, Pete -- https://mail.python.org/mailman/listinfo/python-list

Re: Using sudo with pip3?

2017-01-08 Thread Hans-Peter Jansen
On Samstag, 7. Januar 2017 19:07:55 Clint Moyer wrote: > I would lightly advise against, assuming both Pip and your package > manager are trying to accomplish nearly the same thing. Stick with > updating through the repo. > > If you find that the version your OS provides is out-of-date compared >

Re: Choosing a Python IDE. what is your Pythonish recommendation? I

2017-01-06 Thread Hans-Peter Jansen
On Montag, 2. Januar 2017 03:38:53 Antonio Caminero Garcia wrote: > Hello, I am having a hard time deciding what IDE or IDE-like code editor > should I use. This can be overwhelming. > > So far, I have used Vim, Sublime, Atom, Eclipse with PyDev, Pycharm, > IntelliJ with Python plugin. Well, since

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Hans-Peter Jansen
On Montag, 2. Januar 2017 03:38:53 Antonio Caminero Garcia wrote: > Hello, I am having a hard time deciding what IDE or IDE-like code editor > should I use. This can be overwhelming. > > So far, I have used Vim, Sublime, Atom, Eclipse with PyDev, Pycharm, > IntelliJ with Python plugin. Well, sinc

Re: ctypes, memory mapped files and context manager

2016-12-29 Thread Hans-Peter Jansen
Dear Eryk, thanks for chiming in. On Donnerstag, 29. Dezember 2016 21:27:56 eryk sun wrote: > On Thu, Dec 29, 2016 at 12:18 PM, Hans-Peter Jansen wrote: > >> >>> import weakref, ctypes > >> >>> T = ctypes.c_ubyte * 3 > >> >>&g

Re: ctypes, memory mapped files and context manager

2016-12-29 Thread Hans-Peter Jansen
On Donnerstag, 29. Dezember 2016 09:33:59 Peter Otten wrote: > Hans-Peter Jansen wrote: > > On Mittwoch, 28. Dezember 2016 16:53:53 Hans-Peter Jansen wrote: > > The minimal example is > > >>> import weakref, ctypes > >>> T = ctypes.c_ubyte * 3 > >

Re: ctypes, memory mapped files and context manager

2016-12-28 Thread Hans-Peter Jansen
On Mittwoch, 28. Dezember 2016 16:53:53 Hans-Peter Jansen wrote: > On Mittwoch, 28. Dezember 2016 15:17:22 Hans-Peter Jansen wrote: > > On Mittwoch, 28. Dezember 2016 13:48:48 Peter Otten wrote: > > > Hans-Peter Jansen wrote: > > > > Dear Peter, > > > >

Re: ctypes, memory mapped files and context manager

2016-12-28 Thread Hans-Peter Jansen
On Mittwoch, 28. Dezember 2016 21:58:38 Peter Otten wrote: > Hans-Peter Jansen wrote: > > On Mittwoch, 28. Dezember 2016 13:48:48 Peter Otten wrote: > >> Hans-Peter Jansen wrote: > > It leaves the question on why is Python2 acting as one would expect > > related to

Re: ctypes, memory mapped files and context manager

2016-12-28 Thread Hans-Peter Jansen
On Mittwoch, 28. Dezember 2016 15:17:22 Hans-Peter Jansen wrote: > On Mittwoch, 28. Dezember 2016 13:48:48 Peter Otten wrote: > > Hans-Peter Jansen wrote: > > > Dear Peter, > > > > > > thanks for taking valuable time to look into my issue. > > > >

Re: ctypes, memory mapped files and context manager

2016-12-28 Thread Hans-Peter Jansen
On Mittwoch, 28. Dezember 2016 13:48:48 Peter Otten wrote: > Hans-Peter Jansen wrote: > > Dear Peter, > > > > thanks for taking valuable time to look into my issue. > > You're welcome! > > > It might be related to my distinct silliness, but the pr

Re: ctypes, memory mapped files and context manager

2016-12-28 Thread Hans-Peter Jansen
Dear Peter, thanks for taking valuable time to look into my issue. It might be related to my distinct silliness, but the problem persists with your code as well. Further comments inlined. On Dienstag, 27. Dezember 2016 21:39:51 Peter Otten wrote: > Hans-Peter Jansen wrote: > > &g

ctypes, memory mapped files and context manager

2016-12-27 Thread Hans-Peter Jansen
Hi, I'm using $subjects combination successfully in a project for creating/iterating over huge binary files (> 5GB) with impressive performance, while resource usage keeps pretty low, all with plain Python3 code. Nice! Environment: (Python 3.4.5, Linux 4.8.14, openSUSE/x86_64, NFS4 and XFS fil

distutils_ui 0.1.1 released

2016-12-04 Thread Hans-Peter Jansen
For those of you, who like PyQt{4,5} as much as I do, as well as for those who don't like it that much, because of the poor integration with setuptools et.al., here's another piece of software to bridge the gap: A distutils build extension for PyQt{4,5} applications that makes handling

Re: Python 2.7.5: Strange and differing behavior depending on sys.setdefaultencoding being set

2013-12-03 Thread Hans-Peter Jansen
Hi Chris, On Mittwoch, 4. Dezember 2013 10:20:31 Chris Angelico wrote: > On Wed, Dec 4, 2013 at 9:32 AM, Hans-Peter Jansen wrote: > > I'm experiencing strange behavior with attached code, that differs > > depending on sys.setdefaultencoding being set or not. If it is set, t

Python 2.7.5: Strange and differing behavior depending on sys.setdefaultencoding being set

2013-12-03 Thread Hans-Peter Jansen
Hi, I'm experiencing strange behavior with attached code, that differs depending on sys.setdefaultencoding being set or not. If it is set, the code works as expected, if not - what should be the usual case - the code fails with some non-sensible traceback. I tried to boil it down to a comprehe

How can I redirect or launch a html file in wsgi coding?

2013-08-15 Thread Hans
Hi, I have code like this: root@lin-ser-1:~# cat /usr/local/www/wsgi-scripts/myapp.py def application(environ, start_response): import sys ... status = '200 OK' req_method=environ['REQUEST_METHOD'] if req_method == 'POST' : json_received = environ['wsgi.input'].read

how can I check if group member exist ?

2013-06-21 Thread Hans
Hi, I'm doing a regular expression matching, let's say "a=re.search(re_str,match_str)", if matching, I don't know how many str/item will be extracted from re_str, maybe a.group(1), a.group(2) exist but a.group(3) does not. Can I somehow check it? something like: if exist(a.group(1)): print a.

Re: using split for a string : error

2013-01-25 Thread Hans Mulder
On 25/01/13 15:04:02, Neil Cerutti wrote: > On 2013-01-25, Oscar Benjamin wrote: >> On 24 January 2013 11:35, Chris Angelico wrote: >>> It's usually fine to have int() complain about any >>> non-numerics in the string, but I must confess, I do sometimes >>> yearn for atoi() semantics: atoi("123as

Re: urllib2 FTP Weirdness

2013-01-23 Thread Hans Mulder
On 24/01/13 00:58:04, Chris Angelico wrote: > On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash > wrote: >> Python 2.7.3 on linux >> >> This has me fairly stumped. It looks like >> urllib2.urlopen("ftp://some.ftp.site/path";).read() >> will either immediately return '' or hang indefinitely. But >

Re: please i need explanation

2013-01-11 Thread Hans Mulder
On 11/01/13 16:35:10, kwakukwat...@gmail.com wrote: > def factorial(n): > if n<2: > return 1 > f = 1 > while n>= 2: > f *= n > f -= 1 U think this line should have been: n -= 1 > return f Hope this helps, -- HansM -- http://mail.python.o

Re: help

2013-01-11 Thread Hans Mulder
On 10/01/13 19:35:40, kwakukwat...@gmail.com wrote: > pls this is a code to show the pay of two people.bt I want each of to be > able to get a different money when they enter their user name,and to use > it for about six people. > database = [ > ['Mac'], > ['Sam'], > ] > pay1 = 1000 > p

Re: Numpy outlier removal

2013-01-06 Thread Hans Mulder
On 6/01/13 20:44:08, Joseph L. Casale wrote: > I have a dataset that consists of a dict with text descriptions and values > that are integers. If > required, I collect the values into a list and create a numpy array running > it through a simple > routine: data[abs(data - mean(data)) < m * std(da

Re: Missing something obvious with python-requests

2013-01-04 Thread Hans Mulder
On 4/01/13 03:56:47, Chris Angelico wrote: > On Fri, Jan 4, 2013 at 5:53 AM, Ray Cote > wrote: >> proxies = { >> 'https': '192.168.24.25:8443', >> 'http': '192.168.24.25:8443', } >> >> a = requests.get('http://google.com/', proxies=proxies) >> >> >> When I look at the proxy log, I see a GE

Re: Question about nested loop

2012-12-31 Thread Hans Mulder
On 31/12/12 11:02:56, Isaac Won wrote: > Hi all, > I am a very novice for Python. Currently, I am trying to read continuous > columns repeatedly in the form of array. > my code is like below: > > import numpy as np > > b = [] > c = 4 > f = open("text.file", "r") > > while c < 10: > c =

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Hans Mulder
On 31/12/12 12:57:59, Adam Tauno Williams wrote: > On Thu, 2012-12-27 at 12:01 -0800, mogul wrote: >> 'Aloha! >> I'm new to python, got 10-20 years perl and C experience, all gained >> on unix alike machines hacking happily in vi, and later on in vim. >> Now it's python, and currently mainly on my

Re: Python lists

2012-12-30 Thread Hans Mulder
On 30/12/12 23:25:39, Evan Driscoll wrote: > On 12/30/2012 4:19 PM, Hans Mulder wrote: >> If it's okay to modify the original list, you can simply do: >> >> l[0] = split(l[0], ", ") >> >> If modifying the original is not okay, the simple solution wo

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Hans Mulder
Hello, Python does not support REAL numbers. It has float number, which are approximations of real numbers. They behave almost, but not quite, like you might expect. It also has Decimal numbers. They also approximate real numbers, but slightly differently. They might behave more like you'd ex

Re: Python lists

2012-12-30 Thread Hans Mulder
On 28/12/12 18:46:45, Alex wrote: > Manatee wrote: > >> On Friday, December 28, 2012 9:14:57 AM UTC-5, Manatee wrote: >>> I read in this: >>> >>> ['C100, C117', 'X7R 0.033uF 10% 25V 0603', '0603-C_L, 0603-C_N', >>> '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', >>> 'Digi-Key',

Re: Tarfile and usernames

2012-12-30 Thread Hans Mulder
On 30/12/12 19:57:31, Nicholas Cole wrote: > Dear List, > > I'm hoping to use the tarfile module in the standard library to move > some files between computers. > > I can't see documented anywhere what this library does with userids and > groupids. I can't guarantee that the computers involved

Re: need a url that its http response header that cotain 401 status code

2012-12-26 Thread Hans Mulder
On 26/12/12 10:08:41, iMath wrote: > I am going to do a Basic Authentication , > so I need a url > that its http response header that cotain 401 status code. Isn't that backwards? I mean, what's the point of implementing Basic Authentication, unless you already know a site that uses it? if yo

Re: Forking into the background (Linux)

2012-12-23 Thread Hans Mulder
On 24/12/12 01:50:24, Olive wrote: > My goal is to write a script that 1) write something to stdout; then > fork into the background, closing the stdout (and stderr, stdin) pipe. > > I have found this answer (forking -> setsid -> forking) > http://stackoverflow.com/a/3356154 > > However the stand

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread Hans Mulder
On 24/12/12 01:34:47, iMath wrote: > how to detect the character encoding in a web page ? That depends on the site: different sites indicate their encoding differently. > such as this page: http://python.org/ If you download that page and look at the HTML code, you'll find a line: So it's

Re: redirect standard output problem

2012-12-21 Thread Hans Mulder
On 21/12/12 06:23:18, iMath wrote: > redirect standard output problem > > why the result only print A but leave out 888 ? > > import sys > class RedirectStdoutTo: > > def __init__(self, out_new): > self.out_new = out_new > def __enter__(self): > sys.stdout = self.out_new

Re: Build and runtime dependencies

2012-12-20 Thread Hans Mulder
On 20/12/12 23:11:45, Jack Silver wrote: > I have two Linux From Scratch machine. > > On the first one (the server), I want to build install python 3.3.0 in a > shared filesystem and access it from the second one (the client). These > machines are fairly minimal in term of the number of software i

Re: Strange effect with import

2012-12-20 Thread Hans Mulder
On 20/12/12 23:52:24, Jens Thoms Toerring wrote: > I'm writing a TCP server, based on SocketServer: > > server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler) > > where ReqHandler is the name of a class derived from > SocketServer.BaseRequestHandler > > class ReqHandler(SocketServe

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Hans Mulder
On 20/12/12 16:20:13, Johannes Bauer wrote: > On 20.12.2012 16:05, Chris Angelico wrote: >> On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer wrote: >>> def fetchmanychks(cursor): >>> cursor.execute("SELECT id FROM foo;") >>> while True: >>> result = cursor.fetchmany(

Re: Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread Hans Mulder
On 19/12/12 22:40:00, saqib.ali...@gmail.com wrote: > > > I'm using python 2.6.4 on Solaris 5-10. > > I have a file named "myFile". It is owned by someone else, by > I ("myuser") am in the file's group ("mygrp"). Below is my python > code. Why does it tell me that mygrp has no members??? > > >

Re: Virtualenv loses context

2012-12-19 Thread Hans Mulder
On 19/12/12 15:38:01, rhythmicde...@gmail.com wrote: > Just installed a brand new virtualenv along with two packages. Ran this and I > got nothing: > > (venvtest)[swright@localhost venvtest]$ python -m site > (venvtest)[swright@localhost venvtest]$ > > I expected to have at least one path in sys

Re: Problem with Threads

2012-12-19 Thread Hans Mulder
On 19/12/12 18:11:37, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. > Any idea.?? Why would you want to do that? It's not going to be any faster, since your code is CPU-bound. You may have several CPUs, but CPython is going to use only one

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Hans Mulder
On 18/12/12 22:34:08, Tom Borkin wrote: > Hi; > I have this test code: > > if i_id == "1186": > sql = 'insert into interactions values(Null, %s, "Call Back", > "%s")' % (i_id, date_plus_2) > cursor.execute(sql) > db.commit() > print sql > It prints the sql statement, b

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 17/12/12 21:56:50, py_genetic wrote: > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB < > /home/myusr/jobs/APP_JOBS/JOB_XXX.SQL > /home/myusr/jobs/APP_JOBS/JOB_XXX.TXT If you're trying to interact with a MySQL database, then you should really

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 11:39:56, Dave Angel wrote: > On 12/18/2012 05:27 AM, Hans Mulder wrote: >> On 18/12/12 06:10:43, photonym...@gmail.com wrote: >>> I hope I understand the question... but shouldn't you wait for the process >>> to complete before exiting? >

Re: Delete dict and subdict items of some name

2012-12-18 Thread Hans Mulder
On 18/12/12 06:30:48, Gnarlodious wrote: > This problem is solved, I am so proud of myself for figuring it out! > After reading some of these ideas I discovered the plist is really > lists underneath any "Children" key: > > > from plistlib import readPlist > > def explicate(listDicts): > f

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 06:10:43, photonym...@gmail.com wrote: > I hope I understand the question... but shouldn't you wait for the process to > complete before exiting? > > Something like: > > pid = subprocess.Popen(...) > pid.wait() > > Otherwise, it'll exit before the background process is done. Why w

Re: Unicode

2012-12-17 Thread Hans Mulder
On 17/12/12 22:09:04, Dave Angel wrote: > print src.decode("utf-8").encode("latin-1", "ignore") > > That says to decode it using utf-8 (because the html declared a utf-8 > encoding), and encode it back to latin-1 (because your terminal is stuck > there), then print. > > > Just realize that once

Re: Running a python script under Linux

2012-12-14 Thread Hans Mulder
On 14/12/12 14:38:25, D'Arcy J.M. Cain wrote: > On Fri, 14 Dec 2012 14:18:28 +0100 > Hans Mulder wrote: >> The Pythonic way to get what you want, is to be explicit: >> >> #!/usr/local/bin/python2.7 -V >> >> If you do that, it will even work in situations

Re: Running a python script under Linux

2012-12-14 Thread Hans Mulder
On 14/12/12 03:45:18, Steven D'Aprano wrote: > I understand this is not exactly a Python question, but it may be of > interest to other Python programmers, so I'm asking it here instead of a > more generic Linux group. > > I have a Centos system which uses Python 2.4 as the system Python, so I

Re: regex walktrough

2012-12-08 Thread Hans Mulder
On 8/12/12 23:57:48, rh wrote: > Not sure if the \w sequence includes the - or the . or the / > I think it does not. You guessed right: >>> [ c for c in 'x-./y' if re.match(r'\w', c) ] ['x', 'y'] >>> So x and y match \w and -, . and / do not. Hope this helps, -- HansM -- http://mail.python

Re: regex walktrough

2012-12-08 Thread Hans Mulder
On 8/12/12 23:19:40, rh wrote: > I reduced the expression too. Now I wonder why re.DEBUG doesn't unroll > category_word. Some other re flag? he category word consists of the '_' character and the characters for which .isalnum() return True. On my system there are 102158 characters matching '\w':

Re: Issue with seeded map generation

2012-12-08 Thread Hans Mulder
On 8/12/12 22:32:22, Graham Fielding wrote: > Hey, all! > > I've managed to get my project to a semi-playable state (everything > functions, if not precisely the way I'd like it to). One small issue is > that when the player moves from one level to the next, the items and > monsters in the previ

Re: regex walktrough

2012-12-08 Thread Hans Mulder
On 8/12/12 18:48:13, rh wrote: > Look through some code I found this and wondered about what it does: > ^(?P[0-9A-Za-z-_.//]+)$ > > Here's my walk through: > > 1) ^ match at start of string > 2) ?P if a match is found it will be accessible in a > variable salsipuedes I wouldn't call it a variab

Re: python 3.3 urllib.request

2012-12-08 Thread Hans Mulder
On 8/12/12 07:20:55, Terry Reedy wrote: > On 12/7/2012 12:27 PM, Hans Mulder wrote: >> On 7/12/12 13:52:52, Steeve C wrote: >>> hello, >>> >>> I have a python3 script with urllib.request which have a stra

Re: python 3.3 urllib.request

2012-12-07 Thread Hans Mulder
On 7/12/12 13:52:52, Steeve C wrote: > hello, > > I have a python3 script with urllib.request which have a strange > behavior, here is the script : > > + > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > > import

Re: pyodbc utf-8

2012-12-07 Thread Hans Mulder
On 7/12/12 08:41:27, Markus Christen wrote: > good morning > > i am using pyodbc 3.0.6 for win32 python 2.7.3 > i used it to connect with a MsSql db. Now i have a little problem with the > umlaut. > i cant change anything in the db and there are umlauts like "ä", "ö" and "ü" saved. > so i have to

Re: Confused compare function :)

2012-12-06 Thread Hans Mulder
On 6/12/12 14:58:01, Chris Angelico wrote: > On Fri, Dec 7, 2012 at 12:33 AM, Thomas Rachel > > wrote: >> > Am 06.12.2012 09:49 schrieb Bruno Dupuis: >> > >>> >> The point is Exceptions are made for error handling, not for normal >>> >> workflow. I hate when i read that for example: >>> >> >>> >>

Re: Confused compare function :)

2012-12-06 Thread Hans Mulder
On 6/12/12 12:55:16, peter wrote: > Is perfectly right to use try catch for a flow control. > Just think in something more complex like this. > >try: > self._conn = MySQLdb.connect(host=host, > user=user, > passwd=passwd, > db=db) >

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread Hans Mulder
On 6/12/12 11:07:51, iMath wrote: > the following code originally from > http://zetcode.com/databases/mysqlpythontutorial/ > within the "Writing images" part . > > > import MySQLdb as mdb > import sys > > try: > fin = open("Chrome_Logo.svg.png",'rb') > img = fin.read() > fin.close()

Re: Installing packages on Mac OS X 10.7.5

2012-12-05 Thread Hans Mulder
On 6/12/12 00:56:55, Irmen de Jong wrote: > On 6-12-2012 0:12, John Dildy wrote: >> I have python v2.7.1 and I am trying to install packages on the Mac OS X >> v10.7.5 >> I am trying to install: >> Distribute >> Nose >> virtualenv >> If anyone can help me that would be great > > Avoid changing st

Re: mini browser with python

2012-12-05 Thread Hans Mulder
On 5/12/12 22:44:21, inq1ltd wrote: > I can connect to and download a web page, > html code, and save it to a file. If connected > to the web, I can change the settings on KWrite > to open the file and navigate the page, > (just like a browser does). > I want to view the html file without using a

Re: mini browser with python

2012-12-05 Thread Hans Mulder
On 5/12/12 20:36:04, inq1ltd wrote: > Python help. ?This is not a Python question. > I can connect to and download a web page, > html code, and save it to a file. If connected > to the web, I can use KWrite to open the file > and navigate the page. > I want to view the html file without

Re: Conversion of List of Tuples

2012-12-04 Thread Hans Mulder
On 4/12/12 10:44:32, Alexander Blinne wrote: > Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: >> Dear Group, >> >> I have a tuple of list as, >> >> tup_list=[(1,2), (3,4)] >> Now if I want to covert as a simple list, >> >> list=[1,2,3,4] >> >> how may I do that? > > Another approach that h

Re: Weird exception handling behavior -- late evaluation in except clause

2012-12-02 Thread Hans Mulder
On 2/12/12 18:25:22, Roy Smith wrote: > This is kind of weird (Python 2.7.3): > > try: > print "hello" > except foo: > print "foo" > > prints "hello". The problem (IMHO) is that apparently the except clause > doesn't get evaluated until after some exception is caught. Which means > it

Re: Weird import failure with "nosetests --processes=1"

2012-11-29 Thread Hans Mulder
On 29/11/12 04:13:57, Roy Smith wrote: > I've got a minimal test script: > > - > $ cat test_foo.py > import pyza.models > print pyza.models > > def test_foo(): > pass > - > > pyza.models is a package. Under normal conditions, I can imp

Re: Getting a seeded value from a list

2012-11-26 Thread Hans Mulder
On 26/11/12 21:17:40, Prasad, Ramit wrote: > Chris Angelico wrote: >> >> On Sat, Nov 24, 2012 at 3:27 AM, Prasad, Ramit >> wrote: >>> Steven D'Aprano wrote: On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: > However, this still means that the player will see the exact s

Re: How to pass class instance to a method?

2012-11-26 Thread Hans Mulder
On 27/11/12 00:07:10, Ian Kelly wrote: > On Mon, Nov 26, 2012 at 2:58 PM, Dave Angel wrote: >> Not how I would put it. In a statically typed language, the valid types >> are directly implied by the function parameter declarations, > > As alluded to in my previous post, not all statically typed l

Re: How to get a "screen" length of a multibyte string?

2012-11-25 Thread Hans Mulder
On 25/11/12 11:19:18, kobayashi wrote: > Hello, > > Under platform that has fixed pitch font, > I want to get a "screen" length of a multibyte string > > --- sample --- > s1 = u"abcdef" > s2 = u"あいう" # It has same "screen" length as s1's. > print len(s1) # Got 6 > print len(s2) # Got 3, but I w

Re: Print value from array

2012-11-23 Thread Hans Mulder
On 22/11/12 19:44:02, Mike wrote: > Hello, > I am noob en python programing, i wrote a perl script for read from csv but > now i wish print value but the value must be within double quote and I can > not do this. > > For example now the output is: > > ma user@domain displayName Name SecondNam

Re: mysql insert with tuple

2012-11-21 Thread Hans Mulder
On 21/11/12 18:19:15, Christian wrote: > Hi , > > my purpose is a generic insert via tuple , because the number of fields and > can differ. But I'm stucking . > > ilist=['hello',None,7,None,None] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(""" INSER

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Hans Mulder
On 21/11/12 17:59:05, Alister wrote: > On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > >> I just came across this: >> > 'spam'.find('', 5) >> -1 >> >> >> Now, reading find's documentation: >> > print(str.find.__doc__) >> S.find(sub [,start [,end]]) -> int >> >> Return the lowe

Re: 10 sec poll - please reply!

2012-11-21 Thread Hans Mulder
On 21/11/12 02:17:26, Steven D'Aprano wrote: > On Tue, 20 Nov 2012 18:00:59 -0600, Tim Chase wrote: > >> On 11/20/12 06:18, Michael Herrmann wrote: >>> am having difficulty picking a name for the function that simulates key >>> strokes. I currently have it as 'type' but that clashes with the >>> b

Re: "Premature end of script headers: wsgihandler.py" on usage of BytesIO()

2012-11-19 Thread Hans Mulder
On 19/11/12 14:29:13, Yasir Saleem wrote: > Hi all, > > I am generating graphs using "cairo plot" in web2py project. > Here I am using BytesIO() stream for generating graphs. > Everything runs fine when I run on localhost but when I deploy > it on apache server and then run from different machines

Re: Unpaking Tuple

2012-11-18 Thread Hans Mulder
On 9/10/12 08:07:32, Bob Martin wrote: > in 682592 20121008 232126 "Prasad, Ramit" wrote: >> Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at = >> 03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_= >> tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if le

Re: Detect file is locked - windows

2012-11-14 Thread Hans Mulder
On 14/11/12 11:02:45, Tim Golden wrote: > On 14/11/2012 00:33, Ali Akhavan wrote: >> I am trying to open a file in 'w' mode open('file', 'wb'). open() >> will throw with IOError with errno 13 if the file is locked by >> another application or if user does not have permission to open/write >> to the

Re: Detect file is locked - windows

2012-11-14 Thread Hans Mulder
On 14/11/12 02:14:59, Mark Lawrence wrote: > On 14/11/2012 00:33, Ali Akhavan wrote: >> I am trying to open a file in 'w' mode open('file', 'wb'). open() will >> throw with IOError with errno 13 if the file is locked by another >> application or if user does not have permission to open/write to the

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-14 Thread Hans Mulder
On 13/11/12 22:36:47, Thomas Rachel wrote: > Am 12.11.2012 19:30 schrieb Hans Mulder: > >> This will break if there are spaces in the file name, or other >> characters meaningful to the shell. If you change if to >> >> xargsproc.append(

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 18:22:44, jkn wrote: > Hi Hans > > On Nov 12, 4:36 pm, Hans Mulder wrote: >> On 12/11/12 16:36:58, jkn wrote: >> >> >> >> >> >> >> >> >> >>> slight followup ... >> >>> I have made some progre

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 16:36:58, jkn wrote: > slight followup ... > > I have made some progress; for now I'm using subprocess.communicate to > read the output from the first subprocess, then writing it into the > secodn subprocess. This way I at least get to see what is > happening ... > > The reason 'we' w

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 7/11/12 01:13:47, Steven D'Aprano wrote: > On Tue, 06 Nov 2012 23:08:11 +, Prasad, Ramit wrote: > >> Steven D'Aprano wrote: >>> >>> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: >>> > To enter the newline, I typed Ctrl-Q to tell bash to treat the next > character as a lit

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 6/11/12 23:50:59, Steven D'Aprano wrote: > On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: > >>> To enter the newline, I typed Ctrl-Q to tell bash to treat the next >>> character as a literal, and then typed Ctrl-J to get a newline. >> >> That sounds complicated, my version of bash let

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-08 Thread Hans Mulder
On 8/11/12 19:05:11, jkn wrote: > Hi All > i am trying to build up a set of subprocess.Ponen calls to > replicate the effect of a horribly long shell command. I'm not clear > how I can do one part of this and wonder if anyone can advise. I'm on > Linux, fairly obviously. > > I have a command w

Re: Right solution to unicode error?

2012-11-08 Thread Hans Mulder
On 8/11/12 00:53:49, Steven D'Aprano wrote: > This error confuses me. Is that an exact copy and paste of the error, or > have you edited it or reconstructed it? Because it seems to me that if > task.subject is a unicode string, as it appears to be, calling print on > it should succeed: > > py>

Re: Base class and Derived class question

2012-11-06 Thread Hans Mulder
On 6/11/12 14:47:03, cyberira...@gmail.com wrote: > Hey guys, > I'm trying to understand how is working base class and derived class. > So, I have to files baseClass.py and derivedClass.py. > baseClass.py : > [CODE]class baseClass(): > def bFunction(self): > print "We are in a base cl

Re: Multi-dimensional list initialization

2012-11-05 Thread Hans Mulder
On 5/11/12 07:27:52, Demian Brecht wrote: > So, here I was thinking "oh, this is a nice, easy way to initialize a 4D > matrix" > (running 2.7.3, non-core libs not allowed): > > m = [[None] * 4] * 4 > > The way to get what I was after was: > > m = [[None] * 4, [None] * 4, [None] * 4, [None * 4]]

Re: is implemented with id ?

2012-11-04 Thread Hans Mulder
On 4/11/12 06:09:24, Aahz wrote: > In article , > Chris Angelico wrote: >> On Sun, Nov 4, 2012 at 2:10 PM, Steven D'Aprano >> wrote: >>> >>> /* Shortcut for empty or interned objects */ >>> if (v == u) { >>> Py_DECREF(u); >>> Py_DECREF(v); >>> return 0; >>> } >>> result = unicode_com

Re: is implemented with id ?

2012-11-03 Thread Hans Mulder
On 3/11/12 20:41:28, Aahz wrote: > [got some free time, catching up to threads two months old] > > In article <50475822$0$6867$e4fe5...@news2.news.xs4all.nl>, > Hans Mulder wrote: >> On 5/09/12 15:19:47, Franck Ditter wrote: >>> >>> - I should have

Re: csv read clean up and write out to csv

2012-11-02 Thread Hans Mulder
On 2/11/12 18:25:09, Sacha Rook wrote: > I have a problem with a csv file from a supplier, so they export data to csv > however the last column in the record is a description which is marked up > with html. > > trying to automate the processing of this csv to upload elsewhere in a > useable format

Re: sort order for strings of digits

2012-10-31 Thread Hans Mulder
On 31/10/12 16:17:14, djc wrote: > Python 3.2.3 (default, Oct 19 2012, 19:53:16) > sorted(n+s) > ['1', '10', '101', '13', '1a', '2', '2000', '222 bb', '3', '31', '40', > 'a', 'a1', 'ab', 'acd', 'b a 4', 'bcd'] > sorted(int(x) if x.isdigit() else x for x in n+s) > Traceback (most recent

Re: Error compiling python3.2.3: architecture of input file is incompatible

2012-10-27 Thread Hans Mulder
On 27/10/12 16:11:48, Tobias Marquardt wrote: > Hello, > > I am trying to compile Python 3.2.3. > On my 64 bit Ubuntu machine I have no problems but using Ubuntu 32 but I > get the following error: > > /usr/bin/ld: i386:x86-64 architecture of input file > `Parser/tokenizer_pgen.o' is incompatible

Re: resume execution after catching with an excepthook?

2012-10-25 Thread Hans Mulder
On 24/10/12 14:51:30, andrea crotti wrote: > So I would like to be able to ask for confirmation when I receive a C-c, > and continue if the answer is "N/n". > > I'm already using an exception handler set with sys.excepthook, but I > can't make it work with the confirm_exit, because it's going to q

Re: 'generator ignored GeneratorExit''

2012-10-20 Thread Hans Mulder
On 21/10/12 01:41:37, Charles Hixson wrote: > On 10/20/2012 04:28 PM, Ian Kelly wrote: >> On Sat, Oct 20, 2012 at 2:03 PM, Charles Hixson >> wrote: >>> If I run the following code in the same module, it works correctly, >>> but if I >>> import it I get the message: >>> Exception RuntimeError: 'ge

Re: error executing "import html.parser" from a script

2012-10-19 Thread Hans Mulder
On 19/10/12 11:15:45, Paul Volkov wrote: > What is this madness? That's because your script is called "html.py". If you import html.parser, Python first imports html, then checks that it's a package and contains a module named "parser". When Python imports html, it searches for a file named "htm

  1   2   3   4   5   6   >