Tracing in a Flask application
Hi I would like to do some tracing in a flask. I have been able to trace request in plain python requests using sys.settrace(), but this doesnt work with Flask. Moreover, what i want to trace is in a flask application, when an endpoint is called, what was the request, which parts of the code was executed (i think i can still do it with settrace) and what is the response sent by the application Can you help me to understand which services i can use to do this? Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: What's an elegant way to test for list index existing?
i have a approach, it may not be best fld = [ ] for data in shlex.split(ln): fld.append(data) On Sat, 29 Sep 2018 at 07:52, wrote: > On Friday, September 28, 2018 at 11:03:17 AM UTC-7, Chris Green wrote: > > I have a list created by:- > > > > fld = shlex.split(ln) > > > > It may contain 3, 4 or 5 entries according to data read into ln. > > What's the neatest way of setting the fourth and fifth entries to an > > empty string if they don't (yet) exist? Using 'if len(fld) < 4:' feels > > clumsy somehow. > > How about this? > > from itertools import chain, repeat > temp = shlex.split(ln) > fld = list(chain(temp, repeat("", 5-len(temp > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: What's an elegant way to test for list index existing?
fld = [ ] data = shlex.split(ln) for item in data: fld.append(item) fld = fld + [0] * (5 - len(data)) On Sat, 29 Sep 2018 at 11:03, Glen D souza wrote: > i have a approach, it may not be best > > fld = [ ] > for data in shlex.split(ln): >fld.append(data) > > > > On Sat, 29 Sep 2018 at 07:52, wrote: > >> On Friday, September 28, 2018 at 11:03:17 AM UTC-7, Chris Green wrote: >> > I have a list created by:- >> > >> > fld = shlex.split(ln) >> > >> > It may contain 3, 4 or 5 entries according to data read into ln. >> > What's the neatest way of setting the fourth and fifth entries to an >> > empty string if they don't (yet) exist? Using 'if len(fld) < 4:' feels >> > clumsy somehow. >> >> How about this? >> >> from itertools import chain, repeat >> temp = shlex.split(ln) >> fld = list(chain(temp, repeat("", 5-len(temp >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > -- https://mail.python.org/mailman/listinfo/python-list
Re: Fetch data from two dates query in python and mongoengine
Thanks! On Fri 24 Aug, 2018, 9:01 PM Kunal Jamdade, wrote: > Hi Mahesh, > > Import Q from queryset. > > from mongoengine.queryset.visitor import Q > > ProcessedEmails.objects(Q(first_date) & Q(second_date)) > > > > On Fri, Aug 24, 2018 at 12:41 PM mahesh d wrote: > >> [image: Boxbe] <https://www.boxbe.com/overview> This message is eligible >> for Automatic Cleanup! (mahesh.tec...@gmail.com) Add cleanup rule >> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3D6shxV8TWSzohw7mx55CRTYGVUY%252F%252FUzgpidJKOL6DPTk%253D%26token%3Di2FjTl%252FO8mAwgqs0qhzOJeuhrkyh9QSqLpzpjt2QGdooZjs2O6iBTYSl%252BJH40Q4ohQceN%252FEvdtQjwBD89TS87YKbX1rR%252BK4ufxoZ7yN4tsFOubjkC91wlF7nlodh1CC8JJheu%252FEGxgpj4VWoEwhlKw%253D%253D&tc_serial=42465772179&tc_rand=687678035&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> >> | More info >> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=42465772179&tc_rand=687678035&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> >> Hii >> My model like this >> class ProcessedEmails(Document): >> subject = StringField(max_length=200) >> fromaddress =StringField(max_length=200) >> dateofprocessing = StringField(max_length=25) >> How can find out the records between two dates ?? >> Note: date of processing is string field >> Mongodb database using . >> How to write the query in python by using mongoengine >> >> Thanks >> Mahesh D. >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > -- https://mail.python.org/mailman/listinfo/python-list
Fetch data from two dates query in python and mongoengine
Hii My model like this class ProcessedEmails(Document): subject = StringField(max_length=200) fromaddress =StringField(max_length=200) dateofprocessing = StringField(max_length=25) How can find out the records between two dates ?? Note: date of processing is string field Mongodb database using . How to write the query in python by using mongoengine Thanks Mahesh D. -- https://mail.python.org/mailman/listinfo/python-list
Re: Multi-threading with a simple timer?
I have some success with this. I am not sure if this would work longer term, as in restarting it, but so far so good. Any issue with this new code? import time from threading import Thread th=Thread() class Answer(Thread): def run(self): a=input("What is your answer:") if a=="yes": print("yes you got it") th.daemon=False else: print("no") class myTimer(Thread): def run(self): print() for x in range(5): if th.daemon==True: print(x) time.sleep(1) else: break th.daemon=True Answer().start() myTimer().start() def finished(): print("done") -- https://mail.python.org/mailman/listinfo/python-list
Re: Multi-threading with a simple timer?
This works, but does not do exactly what I want. When the user enters in a correct answer, the program and threading stops. Any ideas on what I should change? import time from threading import Thread class Answer(Thread): def run(self): a=input("What is your answer:") if a=="yes": print("yes you got it") finished() else: print("no") class myTimer(Thread): def run(self): print() for x in range(5): time.sleep(1) Answer().start() myTimer().start() print("you lost") def finished(): print("done") -- https://mail.python.org/mailman/listinfo/python-list
Re: Multi-threading with a simple timer?
This works, but does not do exactly what I want. What I want to happen is : when the user enters in a correct answer, the program and threading stops. Any ideas on what I should change? import time from threading import Thread class Answer(Thread): def run(self): a=input("What is your answer:") if a=="yes": print("yes you got it") finished() else: print("no") class myTimer(Thread): def run(self): print() for x in range(5): time.sleep(1) Answer().start() myTimer().start() print("you lost") def finished(): print("done") -- https://mail.python.org/mailman/listinfo/python-list
Multi-threading with a simple timer?
Is there a SIMPLE method that I can have a TIMER count down at a user input prompt - if the user doesn't enter information within a 15 second period, it times out. I am going to be using pycharm and not the shell. Thanks in advance. -- https://mail.python.org/mailman/listinfo/python-list
Read data from .msg all files
import glob import win32com.client files = glob.glob('C:/Users/A-7993/Desktop/task11/sample emails/*.msg') for file in files: print(file) with open(file) as f: msg=f.read() print(msg) outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") msg = outlook.OpenSharedItem(file) print("FROM:", str(msg.SenderName)) print(msg.SenderEmailAddress) print(msg.SentOn) print(msg.To) print(msg.CC) print(msg.BCC) print(msg.Subject) print(msg.Body) How can read all .msg files in a folder. I used outlook.openshared item it only works one file . How can read the data from .msg files -- https://mail.python.org/mailman/listinfo/python-list
Extract data from multiple text files
import glob,os import errno path = 'C:/Users/A-7993\Desktop/task11/sample emails/' files = glob.glob(path) '''for name in files: print(str(name)) if name.endswith(".txt"): print(name)''' for file in os.listdir(path): print(file) if file.endswith(".txt"): print(os.path.join(path, file)) print(file) try: with open(file) as f: msg = f.read() print(msg) except IOError as exc: if exc.errno != errno.EISDIR: raise In the above program . Getting lot of errors . My intention is read the list of the text files in a folder . Print them How can resolve those error -- https://mail.python.org/mailman/listinfo/python-list
Extract data
Hii. I have folder.in that folder some files .txt and some files .msg files. . My requirement is reading those file contents . Extract data in that files . -- https://mail.python.org/mailman/listinfo/python-list
Extract
Hii I have a directory. In that folder .msg files . How can I extract those files. Thanks & regards Mahesh -- https://mail.python.org/mailman/listinfo/python-list
RE: Test 0 and false since false is 0
> From: Sayth Renshaw > > I have been reading this solution > > >>> after = sorted(before, key=lambda x: x == 0 and type(x) == int) > > it is really good, however I don't understand it enough to > reimplement something like that myself yet. > > Though I can that lambda tests for 0 that is equal to an int > why does sorted put them to the end? Because the expression "x == 0 and type(x) == int" has a value of either False or True, and it sorts all the False values before the True values, leaving the order within those sets unchanged. That said, "x is 0" is even simpler. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com -- https://mail.python.org/mailman/listinfo/python-list
RE: Test 0 and false since false is 0
> From: Dan Sommers > > > On Thu, 06 Jul 2017 19:29:00 -0700, Sayth Renshaw wrote: > > > > I have tried or conditions of v == False etc but then the 0's being > > false also aren't moved. How can you check this at once? > > Maybe this will help: > > Python 3.5.3+ (default, Jun 7 2017, 23:23:48) > [GCC 6.3.0 20170516] on linux > Type "help", "copyright", "credits" or "license" for more > information. > >>> False == 0 > True > >>> False is 0 > False Funny how the subject line inadvertently prefigures the answer: False *isn't* 0. False *equals* 0. So just change "==" to "is" and "!=" to "is not" and it should work. Also, it can be done in a single expression, with no local variables. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Working with dictionaries and keys help please!
Learning about dictionaries for a database possibly in the future. On Wednesday, May 31, 2017 at 8:58:39 PM UTC-4, MRAB wrote: > On 2017-06-01 01:29, David D wrote: > > I have a dictionary with a 10 people, the key being a number (0-10) and the > > value being the people's name. I am in the processing of Insert, Adding > > and deleting from the dictionary. All seems well until I delete a person > > and add a new one. The numbers (keys) do not change and so I am getting an > > non-sequential set of numbers for the keys. Is there a way of performing > > this where the key will update so that is continues to work sequentially? > > Here is what I mean > > > > Print dictionary > > {0 John, 1 David, 2 Phil, 3 Bob} > > > > remove 1 David > > {0 John, 2 Phil, 3 Bob} > > > > How can I get it so that the VALUE will reset and it will look like this > > after both adding or deleting? > > > > {0 John, 1 Phil, 2 Bob} > > > Why are you using a dictionary instead of a list? -- https://mail.python.org/mailman/listinfo/python-list
Working with dictionaries and keys help please!
I have a dictionary with a 10 people, the key being a number (0-10) and the value being the people's name. I am in the processing of Insert, Adding and deleting from the dictionary. All seems well until I delete a person and add a new one. The numbers (keys) do not change and so I am getting an non-sequential set of numbers for the keys. Is there a way of performing this where the key will update so that is continues to work sequentially? Here is what I mean Print dictionary {0 John, 1 David, 2 Phil, 3 Bob} remove 1 David {0 John, 2 Phil, 3 Bob} How can I get it so that the VALUE will reset and it will look like this after both adding or deleting? {0 John, 1 Phil, 2 Bob} -- https://mail.python.org/mailman/listinfo/python-list
working with classes, inheritance, _str_ returns and a list
I am creating a parent class and a child class. I am inheriting from the parent with an additional attribute in the child class. I am using __str__ to return the information. When I run the code, it does exactly what I want, it returns the __str__ information. This all works great. BUT 1) I want what is returned to be appended to a list (the list will be my database) 2) I append the information to the list that I created 3) Whenever I print the list, I get a memory location So how do I take the information that is coming out of the child class (as a __str__ string), and keep it as a string so I can append it to the list? pseudo code allcars=[] parent class() def init (self, model, wheels, doors) self.model= model etc child class (parent) def init(self, model, wheels, doors, convertible) super(child, self).__init__(model, wheels, doors) self.convertible = convertible def __str__(self): return "model: " + self.model + etc car1= child(model, wheels, doors, convertible) print car1 Here is where it goes wrong for me allcars.append(car1) I am sure I am making a silly mistake in here somewhere... -- https://mail.python.org/mailman/listinfo/python-list
Re: need some kind of "coherence index" for a group of strings
On 11/3/2016 1:49 PM, jlada...@itu.edu wrote: The Levenshtein distance is a very precise definition of dissimilarity between sequences. It specifies the minimum number of single-element edits you would need to change one sequence into another. You are right that it is fairly expensive to compute. But you asked for an algorithm that would determine whether groups of strings are "sort of similar". How imprecise can you be? An analysis of the frequency of each individual character in a string might be good enough for you. I also once used a Levenshtein distance algo in Python (code snippet D0DE4716-B6E6-4161-9219-2903BF8F547F) to compare names of students (it worked, but turned out to not be what I needed), but you may also be able to use some items "off the shelf" from Python's difflib. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3 raising an error where Python 2 did not
Thanks for the replies. My example seems to be from the fairly harmless end of a wedge of behaviours that are being handled much more sensibly in Python 3. -- https://mail.python.org/mailman/listinfo/python-list
Python 3 raising an error where Python 2 did not
In a program I'm converting to Python 3 I'm examining a list of divisor values, some of which can be None, to find the first with a value greater than 1. Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> None > 1 False Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> None > 1 Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: NoneType() > int() I can live with that but I'm curious why it was decided that this should now raise an error. David Hughes Forestfield Software -- https://mail.python.org/mailman/listinfo/python-list
Re: make an object read only
On Tuesday, 2 August 2016 16:13:01 UTC+1, Robin Becker wrote: > A reportlab user found he was doing the wrong thing by calling canvas.save > repeatedly, our documentation says you should not use Canvas objects after > the > save method has been used. The user had mixed results :( > > It would be better to make the canvas object completely immutable all the way > down when save has been called, .. > > Is there a way to recursively turn everything immutable? > -- > Robin Becker Years ago I contributed a recipe to the O'Reilly Python Cookbook, 2nd Ed - 6.12 Checking an Instance for any State Changes. My original submission was rather more naive than that but Alex Martelli, one of the editors, rather took a fancy to the idea and knocked into the more presentable shape that got published. I'm wondering whether there would be any way of turning this idea around to achieve what you want. -- Regards David Hughes Forestfield Software -- https://mail.python.org/mailman/listinfo/python-list
Installation error, compiling from source on Oracle Linux
I'm installing an app that requires Carbon and some other Python 2.7 features. The version of Oracle Linux we're using comes with 2.6. I've read that it is not a good idea to directly update the O/S as it "may break things" so I'm doing make altinstall. I've downloaded Python-2.7.11 Downloaded zlib-1.2.8 Done ./configure --prefix=/root/Python-2.7.8 --with-libs=/usr/local/lib --disable-ipv6 However, I get an error while compiling. make altinstall gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c In file included from Include/Python.h:58, from ./Modules/python.c:3: Include/pyport.h:256:13: error: #error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" make: *** [Modules/python.o] Error 1 I CAN compile without zlib, but then pip gives an error. python2.7 get-pip.py Traceback (most recent call last): File "get-pip.py", line 19017, in main() File "get-pip.py", line 194, in main bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap import pip zipimport.ZipImportError: can't decompress data; zlib not available I'd use findRPM but that seems to be 2.7.8, not 2.7.11, and it seems reasonable, if I'm building this, to build the most recent version. Any ideas? I have web searched this; I found a bug that was closed in 2014, and I just got all new source *right now*. I'm doing a very vanilla install on Oracle Linux Server release 6.7 Thank you, == John == -- https://mail.python.org/mailman/listinfo/python-list
Frozen apps (py2exe, cx_freeze) built with Python 3.5
Python 3.5 will not run under Windows XP, but what about applications created using py2exe or cx_freeze under Windows 7, 8 or 10, is there any knowledge of whether they will run under XP? Regards, David Hughes Forestfield Software -- https://mail.python.org/mailman/listinfo/python-list
Procedure for downloading and Installing Python 2.7 Modules
Would like to locate and install numpy, scipy and matplotlib with Wing 101 for Python 2.7 Just beginning to use Python 2.7 for engineering work. Any guidance would be appreciated. Thanks, WDA balle...@gmail.com end -- https://mail.python.org/mailman/listinfo/python-list
Re: HELP! How to return the returned value from a threaded function
This worked like a charm. http://code.activestate.com/recipes/84317-easy-threading-with-futures/ -- https://mail.python.org/mailman/listinfo/python-list
Re: HELP! How to return the returned value from a threaded function
> This sounds like homework... what have you tried, and what happened? heheh naaah no cheating here. I just provided the example this way to make as clear as possible what I want to do. Return the returned value from a threaded function. apparently this does not work as I hoped: return Thread(target=message_function).start() > Have you looked at the docs of the threading module? Lost in there -- https://mail.python.org/mailman/listinfo/python-list
HELP! How to return the returned value from a threaded function
Maybe this is pretty simple but seems I am stuck... def message_function(): return "HelloWorld!" def thread_maker(): """ call message_function() using a new thread and return it's "HelloWorld!" """ pass Could someone please complete above script so that: thread_maker() == "HelloWorld!" Please import the library you suggest too. I tried threading but I could not make it work. THX! -- https://mail.python.org/mailman/listinfo/python-list
Re: Not Able to Log in on XNAT server through PyXNAT
On Friday, December 5, 2014 2:41:54 AM UTC-5, dieter wrote: > suyash@gmail.com writes: > > > Hello All, > > > > I have installed pyxnat on my mac. With pyxnat i am trying to access XNAT > > server in our university. As mentioned on the tutorial i tried both ways, > > neither is working. Following error is displayed: > > > central=Interface(server='http://hd-hni-xnat.cac.cornell.edu:8443/xnat') > > User: sdb99 > > Password: > > Traceback (most recent call last): > > File "", line 1, in > > File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line > > 228, in __init__ > > self._get_entry_point() > > File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line > > 268, in _get_entry_point > > raise e > > socket.error: [Errno 54] Connection reset by peer > > "Connection reset by peer" means that the remote server unexpectedly > closed the connection. This may be a problem at the remote site or > an intermediate firewall or the remote site may be unhappy with the > request is hase been presented - and instead of an error response > simply closed the connection (bad behavior). > > I would try to contact the administrators of your "XNAT" server > whether they can provide some help: > > * did your request reached the server (or was it blocked > on its way to the server)? > > * if yes, why was the connection closed (without response). Thanks a ton for the help. i will check with our server administrator. -- https://mail.python.org/mailman/listinfo/python-list
Not Able to Log in on XNAT server through PyXNAT
Hello All, I have installed pyxnat on my mac. With pyxnat i am trying to access XNAT server in our university. As mentioned on the tutorial i tried both ways, neither is working. Following error is displayed: >>> central=Interface(server='http://hd-hni-xnat.cac.cornell.edu:8443/xnat') User: sdb99 Password: Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line 228, in __init__ self._get_entry_point() File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line 268, in _get_entry_point raise e socket.error: [Errno 54] Connection reset by peer Before accessing XNAT using REST API, do i need to make any changes/install something on XNAT server/my pc(have installed Pyxnat)..? Many Thanks in Advance.. Suyash -- https://mail.python.org/mailman/listinfo/python-list
Re: Understanding "help" command description syntax - explanation needed
On 11/5/2014 7:41 AM, Chris Angelico wrote: On Wed, Nov 5, 2014 at 11:31 PM, Ivan Evstegneev wrote: That's what I'm talking about (asking actually), where do you know it from? I know it because I've been a programmer for 39 years. I didn't intend to offence anyone here. Just asked a questions ^_^ Don't worry about offending people. Even if you do annoy one or two, there'll be plenty of us who know to be patient :) And I don't think Larry was actually offended; it's just that some questions don't really have easy answers - imagine someone asking a great mathematician "But how do you KNOW that 2 + 2 is 4? Where's it written down?"... all he can say is "It is". But it *can* be interesting to try and do otherwise. http://en.wikipedia.org/wiki/Principia_Mathematica -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] spelling colour / color was Re: Toggle
On 10/9/2014 3:53 PM, Tim Delaney wrote: That would be a theatre programme vs a computer program. I try to stick with the current spelling style when modifying existing code - esp. for APIs. It's very annoying to have some methods use "z" and others "s" in the same package. So since I'm currently working for a US company I have to consciously remind myself to use their abominations ;) Yes, we must not allow unmetred errour to paralyse communication. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what?
On 9/30/2014 7:35 AM, c...@isbd.net wrote: Thus I'd have something like (apologies for any syntax errors):- cfg = { "LeisureVolts": ["AIN0", 0.061256, "Leisure Battery Voltage"], "StarterVolts": ["AIN1", 0.060943, "Starter Battery Voltage"], "LeisureAmps1": ["AIN2", 0.423122, "Leisure Battery Current"} (It might be better to makes those lists dictionaries, but it shows the idea) Using configparser.ConfigParser to read an ini-format seems like a good idea. I use it for my own numerous fixed format data file definitions, and it's been convenient and even extensible. [LeisureVolts] Description=Leisure Battery Voltage Code=AIN0 Value=0.061256 [StarterVolts] Description=Starter Battery Voltage Code=AIN1 Value=0.060943 [LeisureAmps1] Description=Leisure Battery Current Code=AIN2 Value=0.423122 I've set it up so I can understand abbreviations for the field names, for when I want to be lazy. Some of my values are dictionaries, which looks like this in my files (an alternate spelling of one of the above entries): LeisureVolts=desc:Leisure Battery Voltage code:AIN2 value:0.061256 It's simple to hook into ConfigParser to get whatever meaning you'd like, and whatever verification you'd find necessary. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 help
Hi, Can i be taken off the list please as i am getting too many e-mails. Thank you, David Moorcroft ICT Operations Manager & Website Manager Turves Green Girls' School - Original Message - From: "Steven D'Aprano" To: python-list@python.org Sent: Monday, 15 September, 2014 3:08:09 PM Subject: Re: Python 3.3.2 help Hello David, and thanks for replying. More comments below. D Moorcroft wrote: > Hi, > > We are using windows 7 and it is all pupils as they are more restricted > than staff. > > They are using the python 3.3.2 shell and trying to print from there What you are describing does not sound like the sort of error the Python shell will give. Are you able to copy and paste the student's exact input and output, including the complete error message? If not, can you take a screenshot and post that? (As a general rule, we prefer text-based communication rather than pictures. For all we know, there could be blind or other visually-impaired users on this forum who can read text via a screen reader, but cannot contribute when it is a screenshot. But if all else fails, a screenshot is better than nothing.) We would love to help you, but without further information we have no idea what is going on. The more concrete information you can pass on to us, the better. Regards, Steve > > Thank you, > > David Moorcroft > ICT Operations Manager & > Website Manager > Turves Green Girls' School > > - Original Message - > From: "Steven D'Aprano" > To: python-list@python.org > Sent: Wednesday, 10 September, 2014 1:15:49 PM > Subject: Re: Python 3.3.2 help > > Hello, > > My response is below, interleaved with your comments. > > D Moorcroft wrote: > >>> Hi, >>> >>> We are running Python 3.3.2 but pupils are unable to print as they >>> cannot use the command prompt. > > What operating system are you using? Windows, Linux, Mac? Something else? > > Is it ALL pupils who are unable to print or just some of them? > > Which command prompt are they using? Can you reproduce the failure to > print? If so, please tell us the detailed steps you (and the pupils) go > through. E.g. something like this: > > "On Windows XP, choose Run from the Start Menu. Type cmd.exe and press > Enter. When the terminal window opens, type print 'Hello World' and > Enter." > > It will help if you can tell us whether your pupils are using IDLE, > IPython, or the default Python interactive interpreter. > > If you can answer these questions, which should have a better chance of > diagnosing the problem. > > Further responses below. > > >>> An error comes up saying printing failed (exit status Oxff). > > Based on this, my guess is that your students are accidentally running the > DOS "print" command at the DOS prompt, not Python at all. Perhaps they are > forgetting to run the "python" command first to launch the Python > interpreter, and are running directly in the DOS prompt? > > You can check this by reading the command prompt. If it looks like three > greater-than signs >>> then you are running in Python's default > interpreter. If it looks something like this: > > C:\Documents and Settings\user\> > > or perhaps like this: > > C:\> > > then you are still inside the DOS command prompt. > > Unfortunately, I am not very experienced with Windows, so I cannot tell > you the right method to start Python. I would expect there to be a Start > menu command, perhaps called "IDLE", or "Python", but I'm not sure. > > >>> Is there any way that we can get users who can't see the command >>> prompt to be able to print? > > I'm not entirely sure I understand this question. Can you explain in more > detail? > > By the way, as you know there are two meanings of "print" in computing. > There is printing to the screen, and printing to sheets of paper with an > actual printer. Which are you intending? > > > Regards, > > > -- Steven -- https://mail.python.org/mailman/listinfo/python-list * This message has been checked for viruses by the Birmingham Grid for Learning. For guidance on good e-mail practice, e-mail viruses and hoaxes please visit: http://www.bgfl.org/emailaup * * This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmas...@bgfl.org The views expressed within this email are those of the individual, and not necessarily those of the organisation * -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 help
Hi, We are using windows 7 and it is all pupils as they are more restricted than staff. They are using the python 3.3.2 shell and trying to print from there Thank you, David Moorcroft ICT Operations Manager & Website Manager Turves Green Girls' School - Original Message - From: "Steven D'Aprano" To: python-list@python.org Sent: Wednesday, 10 September, 2014 1:15:49 PM Subject: Re: Python 3.3.2 help Hello, My response is below, interleaved with your comments. D Moorcroft wrote: >> Hi, >> >> We are running Python 3.3.2 but pupils are unable to print as they >> cannot use the command prompt. What operating system are you using? Windows, Linux, Mac? Something else? Is it ALL pupils who are unable to print or just some of them? Which command prompt are they using? Can you reproduce the failure to print? If so, please tell us the detailed steps you (and the pupils) go through. E.g. something like this: "On Windows XP, choose Run from the Start Menu. Type cmd.exe and press Enter. When the terminal window opens, type print 'Hello World' and Enter." It will help if you can tell us whether your pupils are using IDLE, IPython, or the default Python interactive interpreter. If you can answer these questions, which should have a better chance of diagnosing the problem. Further responses below. >> An error comes up saying printing failed (exit status Oxff). Based on this, my guess is that your students are accidentally running the DOS "print" command at the DOS prompt, not Python at all. Perhaps they are forgetting to run the "python" command first to launch the Python interpreter, and are running directly in the DOS prompt? You can check this by reading the command prompt. If it looks like three greater-than signs >>> then you are running in Python's default interpreter. If it looks something like this: C:\Documents and Settings\user\> or perhaps like this: C:\> then you are still inside the DOS command prompt. Unfortunately, I am not very experienced with Windows, so I cannot tell you the right method to start Python. I would expect there to be a Start menu command, perhaps called "IDLE", or "Python", but I'm not sure. >> Is there any way that we can get users who can't see the command >> prompt to be able to print? I'm not entirely sure I understand this question. Can you explain in more detail? By the way, as you know there are two meanings of "print" in computing. There is printing to the screen, and printing to sheets of paper with an actual printer. Which are you intending? Regards, -- Steven -- https://mail.python.org/mailman/listinfo/python-list * This message has been checked for viruses by the Birmingham Grid for Learning. For guidance on good e-mail practice, e-mail viruses and hoaxes please visit: http://www.bgfl.org/emailaup * * This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmas...@bgfl.org The views expressed within this email are those of the individual, and not necessarily those of the organisation * -- https://mail.python.org/mailman/listinfo/python-list
Python 3.3.2 help
> Hi, > > We are running Python 3.3.2 but pupils are unable to print as they > cannot use the command prompt. > > An error comes up saying printing failed (exit status Oxff). > > Is there any way that we can get users who can't see the command > prompt to be able to print? > > Thank you, > > David Moorcroft ICT Operations Manager & Website Manager Turves Green > Girls' School > > > > * This > email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are > addressed. If you have received this email in error please notify > postmas...@bgfl.org > > The views expressed within this email are those of the individual, > and not necessarily those of the organisation > * > * This message has been checked for viruses by the Birmingham Grid for Learning. For guidance on good e-mail practice, e-mail viruses and hoaxes please visit: http://www.bgfl.org/emailaup * * This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmas...@bgfl.org The views expressed within this email are those of the individual, and not necessarily those of the organisation * -- https://mail.python.org/mailman/listinfo/python-list
Re: Manually uninstall python 3.4.1 x64
On 8/29/2014 12:53 PM, Tim Golden wrote: On 29/08/2014 09:19, Curtis Clauson wrote: Unfortunately I don't think there's a simple answer to this one. (Altho' I'm not an MSI expert and I'd be very happy to be overruled). msiexec.exe, which is the program which actually runs the MSIs, has a number of options you can invoke, including a verbose logging option. You can see them all by doing: msiexec /? or, presumably some MSDN page with the same information. Some things which might be worth trying include: msiexec /log whatever.log python-xx-yy.msi to log verbosely, in the hope that some missing or present file or registry might show up. And/or playing with the Repair Options to narrow things down. TJG Actually, I do know more than a little about the Windows MSI service and application, and had already perused the logs to no avail. All of the listed registry keys were deleted without changing the problem. The missing file is of no importance since I already know the installation directory is deleted. It's just that the installer should normally supply that information. The error messages are Windows System errors that are being caused by requirements of the MSI installer file and not the msiexec.exe application. The problem is with how the installer is written and not the MSI system. There's always a simple answer to things like this. It's just that the simple answers are harder to find in poorly written code. I randomly poked around the registry a lot more, deleting anything I could find referring to Python34 and then the string "Python 3.4.1". I finally got desperate enough to delete the python installer entries under the Windows Installer key (the list of installed applications in the Windows "Uninstall or Change a Program" Control Panel). You know, the registry keys you are *NEVER* to use as an indication if the application is currently installed because MS constantly corrupts this list and can leave your installation in an un-installable, un-repairable, and un-removeable state? Well it worked. The Python installer no longer sees the application as installed and happily performs a full installation. I did that, a full removal to get rid of any other problems, and a clean installation and everything works fine now. This installer is seriously screwed up and desperately needs a re-write. It should use its own key to indicate whether the application is installed but should not depend on it in case of a partially installed/removed state, should not require any installed file to fully repair or remove the application, and should query the user if any information required is missing from the installation or registry. In other words, the normal MSI installer guidelines. I hope this is of help to someone out there. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On 8/27/2014 9:40 AM, Jake wrote: Jake I disagree! -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python vs C++
On 8/23/2014 9:00 AM, Chris Angelico wrote: On Sat, Aug 23, 2014 at 10:38 PM, Rustom Mody wrote: Here is an example (not identical but analogous to) where markup+compile is distinctly weaker than wysiwyg: You can use lilypond to type music and the use a midi player to play it But lilypond does not allow playing and seeing-in-realtime WYSIWYG editors allow that -- can make a huge difference to beginners who find music hard to read. I don't buy that it's weaker. In fact, I'd say this proves that markup is distinctly better - just a little harder to do "Hello, world" in. At best, the simple GUI makes it easier to do something straight-forward, and then basically lets you drop to the more complicated form. At worst, it makes it easier to do the very simple, and nearly impossible to do the more complicated. The worst part of using a WYSIWIG program is the frustration of correcting a bewildering problem when some kind of autoformatting magic goes wrong. One odd example is when using Word to compose template documents meant for merging with external data. The markup+compile phase takes on a whole new, horrible meaning. My ears are turning red just imagining the next time I have to do it. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 8/22/2014 3:54 PM, Rob Gaddi wrote: On Fri, 22 Aug 2014 15:46:33 -0400 Seymore4Head wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) The top two answers so far are Emacs and gvim. http://gvim.en.softonic.com/ Has a snazzy look, but I think it is not compatible with Windows so it looks like I might have to try Emacs. gvim runs just fine on Windows. http://www.vim.org/download.php Thanks everyone Emacs and vim both have huge learning curves that I've decided aren't worth climbing. Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. They do have a very long learning incline but it isn't actually as steep as it looks--it's just that it keeps going up as far as you can see. :) If simple things weren't simple to do, neither product would have ever succeeded. The GUI version of Vim (gvim), has beginner modes and Windows-like modes to help with the transitional phases. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 8/22/2014 2:19 PM, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? This sort of simple task is why fancy text editors were invented. I use and recommend gvim (press > in select mode using the standard python plugin), but there are plenty of options out there. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python vs C++
On 8/22/2014 5:29 AM, Marko Rauhamaa wrote: C is readily supported by all extension APIs. Its calling conventions are stable and well-understood. Its runtime requirements are trivial. Plus, you don't have to be a Medieval Scholar to program in it. C itself is very simple (albeit not simple to use). But I contend you do need to be a Medieval Scholar to compile and link it. My mind boggles watching a ./configure vomit ASCII all over my screen. I have to avert my eyes, make a wish, and make install. ;) -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python vs C++
On 8/21/2014 8:54 AM, David Palao wrote: Hello, I consider myself a python programmer, although C++ was one of the first languages I learned (not really deeply and long time ago). Hey, that sounds just like me. Now I decided to retake C++, to broaden my view of the business. However, as I progress in learning C++, I cannot take out of my head one question I have gone back and attempted to use C++ again a couple of times, but it turns out to not be worthwhile in my current position. Why to use C++ instead of python? It is not ranting against C++. I was/am looking for small-medium projects to exercise my C++ skills. But I'm interested in a "genuine" C++ project: some task where C++ is really THE language (and where python is actually a bad ab initio choice). The usual argument in favour of C++ (when comparing to python) is performance. But I'm convinced that, in general, the right approach is "python-profiling-(extension/numpy/Cython/...)". At least for a python programmer. I might be wrong, though. Python, for me, is the ultimate translator and aggregator of data. I use it constantly to get data from one place, combine it with some other data over there, fiddle with it, and spit it out in some usable manner. I could certainly use C++ for my projects. I think the standard containers, iterators, and algorithms provided in the STL are beautiful. Simple things can be relatively simple in C++, when I use the right parts of it. But in that case C++ doesn't provide me many benefits--virtually zero. Python's immutable strings and hash-based mapping type can even be faster than C++ in some cases. But I simply don't need efficiency. My longest running program takes less than 3 seconds to complete, and that's plenty fast for my purpose. The archaic separate compilation/linking model and the complication of static type declarations seem a pain in the ass that I don't benefit very much from. The one program I needed that was just horribly slow in Python involved trying to match up names in a fuzzy manner between two systems, to help me find students who couldn't be bothered to get their own social security number correct. This took nearly 20 minutes to run. But, ummm.., it turned out I was doing the wrong thing. Even students who can't remember their SSN mostly got their phone number or email address correct, it turns out. There's a tall stack of stuff *not* written in Python that I depend on, though: Python itself, sqlite3, gvim, Windows 7, etc. At this point I feel hopelessly unqualified to write any of that stuff, but if I had to, I'd need to resuscitate my C++, or at least my C, as a starting point. There's a growing number of projects hoping to bridge an apparent gap between Python and C. C++ can be regarded as an early effort--so early that there was no Python to measure against. Maybe it would've turned out better if there had been. ;) Python developers are filling part of the gap with libraries, e.g., numpy and scipy. I could take advantage of numpy by installing Pandas; I'll learn Pandas long before I resort to C++. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: how to get the ordinal number in list
On 8/12/2014 2:20 PM, Rustom Mody wrote: On Tuesday, August 12, 2014 11:10:48 PM UTC+5:30, Neil D. Cerutti wrote: Beginners are particularly poor, in relation to experts, at noticing the applicability of idea, and at combining ideas together. Breaking things into component parts has multiple benefits: 1. The applicability of individual ideas becomes obvious. It's one thing to know about [].sort, and another thing to know when it's appropriate to sort something. 2. The expert specifically shows how and why the ideas are combined. This helps build the connection for the beginner, whose knowledge is not stored as an expert stores it; i.e, in broad categories with multiple connections; but as disorganized data with very few connections. Nice! And how do we lead the beginners towards expertise? In a way functional programming is to programming creativity what lego is to children's spatial creativity. Specifically there are a bunch of pieces that need to fit: 1. Functional Programming: Nothing more than composing functions [Maybe a bit simplistic but not unrealistic a defn] 2. Trying this out at the interpreter 3. Introspectable objects Functional programming could be particularly hard to teach since it is generally made up of numerous small units of work combined in a complex way. This is precisely the formula for something that beginners will find extremely challenging. When functional programming is dumbed down enough for a beginner to be able to grok it, the programming problems start to look really lame. It needn't be that way, of course, but it takes a good deal of creativity on the part of the instructor. If Factorial doesn't turn you on, you might be screwed. ;) Some things follow from this: For the lego-game of playing with functions at the REPL to work and be pleasant and rewarding: 1. functions should be non side-effecting; else same trials giving different answers adds more confusion than understanding 2. They should be non-printing else: def foo(x): return x+1 def bar(x): print x+1 look similar when trivially tried but compositionally are utterly different In effect a printing function breaks the lego bricks That may be so, but printing stuff to the screen is very natural to people. I've downloaded Haskell a few times, but the knowledge that getting input and writing output requires something mysterious called gonads just frightens me. [The P in the REPL is DRY enough that it does not usually need to be repeated all over] A good REPL does help a lot, though. 3. Abstractions (class instances) should be avoided in favor of concrete data (lists, dicts, scalars) because they add undue mess at little comprehension advantage. eg take the example of a regex match. It returns some object and then we have to scratch our heads wondering whats in the magic box. If instead of match, we use findall, the data is manifest and obvious. I'm with you on regex: match objects suck. That and escaping. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: how to get the ordinal number in list
On 8/10/2014 2:14 PM, Roy Smith wrote: In article <154cc342-7f85-4d16-b636-a1a953913...@googlegroups.com>, Rustom Mody wrote: l= [6,2,9,12,1,4] sorted(l,reverse=True)[:5] [12, 9, 6, 4, 2] No need to know how sorted works nor [:5] Now you (or Steven) can call it abstract. And yet its 1. Actual running code in the interpreter 2. Its as close as one can get to a literal translation of your "Find the 5 largest numbers in a list" [...] All the above are clearer than loops+assignments and can be taught before them I disagree. For a beginner, you want to be able to break things down into individual steps and examine the result at each point. If you do: l= [6,2,9,12,1,4] l2 = sorted(l,reverse=True) you have the advantage that you can stop after creating l2 and print it out. The student can see that it has indeed been sorted. With the chained operations, you have to build a mental image of an anonymous, temporary list, and then perform the slicing operation on that. Sure, it's the way you or I would write it in production code, but for a beginner, breaking it down into smaller pieces makes it easier to understand. l2[:5] Yes, and that teaching technique is supported by research. Beginners are particularly poor, in relation to experts, at noticing the applicability of idea, and at combining ideas together. Breaking things into component parts has multiple benefits: 1. The applicability of individual ideas becomes obvious. It's one thing to know about [].sort, and another thing to know when it's appropriate to sort something. 2. The expert specifically shows how and why the ideas are combined. This helps build the connection for the beginner, whose knowledge is not stored as an expert stores it; i.e, in broad categories with multiple connections; but as disorganized data with very few connections. http://www.amazon.com/How-Learning-Works-Research-Based-Principles/dp/0470484101 I bought the book based on a recommendation from SciPy talk, and it's really great. As an autodidact, it'll help me teach *myself* better, too. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Specifying `blocking` and `timeout` when acquiring lock as a context manager
On 8/8/2014 2:35 PM, Neil D. Cerutti wrote: Here's another attempt at context managing: @contextlib.contextmanager def release_if_acquired(lock, blocking=True, timeout=-1): acquired = lock.acquire(blocking, timeout) if acquired: yield acquired lock.release() else: yield acquired I should not have used a temporary. @contextlib.contextmanager def release_if_acquired(lock, blocking=True, timeout=-1): if lock.acquire(blocking, timeout) yield True lock.release() else: yield False -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Specifying `blocking` and `timeout` when acquiring lock as a context manager
On 8/8/2014 12:16 PM, Chris Angelico wrote: On Sat, Aug 9, 2014 at 2:05 AM, Neil D. Cerutti wrote: Perhaps defer release, a la a common Go pattern: with contextlib.ExitStack() as stack: acquired = lock.acquire(blocking=False) if acquired: stack.callback(lock.release) do_stuff There's a race condition in that - an unexpected exception could happen between those two. Are you able to set the callback to be a "release if acquired" atomic operation? Doesn't any natural looking use of blocking=False suffer from the same race condition? What's the correct way to use it? Here's another attempt at context managing: @contextlib.contextmanager def release_if_acquired(lock, blocking=True, timeout=-1): acquired = lock.acquire(blocking, timeout) if acquired: yield acquired lock.release() else: yield acquired with release_if_acquired(lock, blocking=False) as acquired: if acquired: do_stuff -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Specifying `blocking` and `timeout` when acquiring lock as a context manager
On 8/8/2014 9:25 AM, Ethan Furman wrote: On 08/08/2014 04:51 AM, cool-RR wrote: If I want to acquire a `threading.Lock` using the context manager protocol, is it possible to specify the `blocking` and `timeout` arguments that `acquire` would usually take? Not that I know of, but why would you want to? There's no built-in 'if' with a 'with' block -- how would your code know whether it ran or not? Perhaps defer release, a la a common Go pattern: with contextlib.ExitStack() as stack: acquired = lock.acquire(blocking=False) if acquired: stack.callback(lock.release) do_stuff -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Classes
On 8/4/2014 6:44 PM, John Gordon wrote: In Shubham Tomar writes: classes. I understand that you define classes to have re-usable methods and procedures, but, don't functions serve the same purpose. Can someone please explain the idea of classes If a function simply accepts some data, does some calculations on that data and then returns a value, then you don't need classes at all. An example of this might be the square-root function: pass it any number and it calculates and returns the square root with no other data needed. But classes do come in handy for other sorts of uses. One classic example is employees at a company. Each employee has a name, ID number, salary, date of hire, home address, etc. You can create an Employee class to store those data items along with methods to manipulate those data items in interesting ways. The data items are specific to each separate Employee object, and the methods are shared among the entire class. In simple cases like that, functions could do very well by including a little bundle of data (probably a dict) as one of the parameters for each related function. Classes help here by organizing the functions into namespaces, and allowing very convenient and explicit syntax for creating objects and using attributes. In addition, classes provide hooks into almost all of Python's syntax and operations, with special methods like __init__, __add__, etc. If you want your employees to be comparable using the <, >, == you need to use classes. Classes provide a means for objects to be related, substitutable, and interdependent, using inheritance. Properties work only with classes and provide a convenient way to customize attribute retrieval and setting without forcing a change in the syntax required for usage. Classes can be constructed dynamically using metaclasses. Some of these things can be emulated using just functions and mappings--it's what C programmers do--but most of classes in Python can do requires language support. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: one to many (passing variables)
On 7/25/2014 9:47 PM, C.D. Reimer wrote: Thank you for the link. I'm curious about one item mentioned in the article: "Avoid return values that Demand Exceptional Processing: return zero-length array or empty collection, not null" Isn't a zero-length array, empty collection and null all the same thing? Or does the "Demand Exceptional Processing" comes from testing to see if the object is empty versus being null? This seems like a specific application of a more general rule (I think I remember it from The C Programming Language by Kernighan and Ritchie): Whenever possible, manage special cases with data rather than with code. Doing so makes your data processing code simpler, and may help prevent errors. This should apply to any programming language. A mundane example is managing multi-line street addresses in a system storing addresses: most applications choose to store address lines as Street Address 1, through Street Address N, for some finite value of N, even though it results in special cases to handle. This is probably because it is more efficient: non-normalised data can be an efficiency win. Also, forgetting or refusing to handle the case of multi-line street addresses works "well enough" most of the time. You could instead store multi-line street addresses as a list of components in the street address: Forgetting to handle the "special cases" would then be impossible. In order to do a cheesy job you'd have to explicitly retrieve street_address[0] and ignore the rest. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: usenet reader software
On 7/22/2014 11:14 AM, Anssi Saari wrote: I don't really know about about html and slrn since I don't see much of it but links in a terminal application is usually something for the terminal to handle. I run Gnus on a remote machine and use a local terminal for display, Konsole in Linux and mintty in Windows. In both of those terminals URLs are opened with a right click on the link and selecting open link from the menu that pops up. That is correct and the way slrn works. You set browser and/or guibrowser options in .slrnrc. With those set, SHIFT-G will troll an open message for web addresses, and you use up and down arrow to select the link you want from the generated list. Then it launches the browser you configured. Getting the escaping, path, and syntax of the browser setting correct was a pain, but after that it worked great. That said, I got tired of the inability to display most special characters correctly (slrn could only do as well the cmd.exe), and have switched to Thunderbird. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3 is killing Python
On 7/16/2014 10:27 AM, Frank Millman wrote: Would this have been so easy using Python2 - I don't think so. What follows is blatant speculation, but it is quite possible that there are many non-English speakers out there that have had their lives made much easier by the changes to Python3 - a 'silent majority'? I don't mean an absolute majority, as I believe there are still more Python2 users than Python3. But of those who have made the switch from 2 to 3, maybe most of them are quite happy. If so, then the python devs got that right as well. Python3 has helped me cope with unexpected non-ASCII characters in other systems on our university campus while using a program written back before I knew anything about unicode. When I first spotted mojibake appearing in a student's name and address, it was only a couple of emails and a little investigation to determine which encoding= bits to sprinkle into my program. And I was finished. I wrote these applications a decade ago in Python2, and never worried about unicode. I translated them to Python3 years ago, and still never worried about unicode. The database is supposed to be sanitized against non-ASCII by an address and name-scrubbing application, which we aspend large amounts of cash on (I don't understand why, but that's what we do). And thanks to Python3, even though "illegal" characters have crept in, and even though I had never worried about unicode before, I could fix my program(s) the instant I knew which encodings to use. It would have been much harder to get right using Python2. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Standard library Help
On 7/11/2014 4:53 AM, Wolfgang Maier wrote: On 07/11/2014 10:32 AM, Nicholas Cannon wrote: Hey i would like to know alot more about the standard library and all of its functions and so on and i know it is huge and i would basically like to learn only the useful stuff that i could use and all of those features. i have been looking around and i cant really find anything so i wondering if you guys would know any places to learn it. Consult the documentation: https://docs.python.org/3/library/index.html It's probably the only place that has everything documented. Instead of reading everything from A-Z though, the more typical approach is to skim through it to know what is available, then read in-depth the parts that seem useful for a concrete problem you're trying to solve currently. In my experience, a thorough understanding of most chapters doesn't come with reading alone, but with practice. I recommend reading and becoming familiar with the first five sections first. You won't get far without the Built-in types and functions. list, dict, set, open, etc., are not in a "library", per se, as other languages usually define it, but that's where they're described in Python's docs. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: open() and EOFError
On 7/7/2014 7:10 PM, Mark Lawrence wrote: On 07/07/2014 23:09, Gregory Ewing wrote: Marko Rauhamaa wrote: with open(path) as f: ... If the open() call is guarded against exceptions (as it usually should), one must revert to the classic syntax: Hmmm, maybe we could do with a with-except statement: with open(path) as f: ... except IOError: # Catches exceptions in the with-expression only ... Although that would be a bit confusing. I wrap the with inside a try/except, the other file handling parts within another try/except and use the finer grained exceptions from PEP 3151 to write (at least to my eye) cleaner looking code. Somehow I think we'll get agreement on the best way to do this when the cows come home. On Windows it's my experience that EOF from interactive sessions is ignored. Programs keep going as best they can, providing some other means of exit, e.g., an 'exit' command. But maybe that's just the shell. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: The “does Python have variables?” debate
On 5/8/2014 8:41 AM, Roy Smith wrote: In article , Jerry Hill wrote: thinking of python variables as having two parts -- names and values -- really can help people who are struggling to learn the language. There's many levels of learning, and we see them all on this list. For people who are just learning programming, and are learning Python as their first language, we need to keep things simple. These are the people who are still struggling to understand basic concepts such as algorithms, loops, and the most fundamental data structures. For those people, talking about variables as a container to hold a value is the right level of abstraction. At some point, that model no longer fits reality well enough that it becomes a barrier to further learning. When I write: def mutate(x, y): x = 42 y[0] = 42 x = 4 y = [4] mutate(x, y) print x, y and run it, unless I really understand about name binding and argument passing, I'm going to be totally befuddled by the result. At that point, I need to unlearn something I thought I understood, and that's really hard (en.wikipedia.org/wiki/Principles_of_learning#Primacy). The "surprising" things can be demonstrated without using functions. Once assignment statements are mastered, the way argument passing works can be extrapolated. New programmers will have to further be taught about shadowing and scopes, while experienced programmers should already be up and running (until they try to get cute). Of course everybody has to eventually learn about the special syntax usable in function definitions and function calls. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: threading
On 4/8/2014 9:09 PM, Rick Johnson wrote: I warn you that not only will "it" impede the interpretation of your ideas, "it" will also degrade your ability to think clearly when expressing yourself and slow (or completely halt) your linguistic evolution. HAVE YOU NOTICED THAT YOUR INNER MONOLOGUE NEVER USES "IT"? Indeed! That's because "it" is a habitual viral infestation of the human communication interface. It strikes me that that's not superior to it. It's ironic that that would be used in place of it in your rant. Plus Rufus Xavier Sasparilla disagrees with it. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Examples of modern GUI python programms
Id like to ask.. do you know any modern looking GUI examples of windows software written in python? Something like this maybe: http://techreport.com/r.x/asus-x79deluxe/software-oc.jpg (or hopefully something like this android look: http://chromloop.com/wp-content/uploads/2013/07/Skype-4.0-Android-screenshot.jpg). What i need is to develop an android looking program (entirelly in python) for windows, but dunno if this is possible (most propably is), and which tool between those would help me most: tkinter - wxpython - pyqt - pygtk . Any examples and suggestions are most welcome. -- https://mail.python.org/mailman/listinfo/python-list
Templating engines that work very well with Python/Django
Can someone suggest a few templating engines that work really well with Django and help in coding efficiency? Where can I fin comparison of tempating engines I can find to know their pros and cons? Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Graph or Chart Software for Django
What is the best Graph or Chart software used with Django (libraries & products), preferably open source? Need something stable and robust, and used by many developers, so active on community channels. Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: python finance
On Monday, January 6, 2014 6:58:30 PM UTC-5, Walter Hurry wrote: > On Mon, 06 Jan 2014 13:11:53 -0800, d ss wrote: > > > > i wrote just 2 words with a clear > > > indicative title: "Python, Finance" which summarizes the following "if > > > you are good in python and interested in applying your python knowledge > > > to the field of finance then we may have a common interest in talking > > > together" :D that s it! > > > > No, you didn't. The title wasn't capitalised. The advertisement was > > similarly poor English, the post was to the wrong mailing list and you > > posted usong G**gle Gs. > You meant USING! -- https://mail.python.org/mailman/listinfo/python-list
Re: python finance
On Monday, January 6, 2014 12:06:45 PM UTC-5, Chris Angelico wrote: > On Tue, Jan 7, 2014 at 3:58 AM, d ss wrote: > > > what the heck! > > > who told you this is a spam! > > > this is a call for cooperation and collaboration > > > how retarded! > > > > It is, at best, misdirected. There is a Python job board [1] where > > these sorts of things can be posted, but the main mailing list isn't > > the place for it. > > > > However, if you want your posts to be seen as legitimate, I would > > recommend putting a little more content into them, and putting some > > effort into the quality of English. Most of us will just skip over > > something that looks like unsolicited commercial email, if we even see > > it at all (spam filtering is getting pretty effective these days). > > > > ChrisA > > > > [1] http://www.python.org/community/jobs/ thanks Chris, i am checking the link i wrote just 2 words with a clear indicative title: "Python, Finance" which summarizes the following "if you are good in python and interested in applying your python knowledge to the field of finance then we may have a common interest in talking together" :D that s it! -- https://mail.python.org/mailman/listinfo/python-list
Re: python finance
what the heck! who told you this is a spam! this is a call for cooperation and collaboration how retarded! On Sunday, January 5, 2014 4:14:22 AM UTC-5, maxwe...@gmail.com wrote: > On Thursday, January 2, 2014 11:37:59 AM UTC, d ss wrote: > > > dailystockselect.com needs a couple of talented python people for the > > development and implementation of new trading strategies. it may be also > > some pythonic design change for the displayed figures now the web app > > consists of 1 of the 8 conceived strategies. contact us at the email on the > > website for more details > > > Samir > > > > Please this is a spam.. I've reported this as a spam. I wish everyone who > sees this also reports it as spam to get the user bannned. This way GG will > be a wee bit better > > > > Thanks -- https://mail.python.org/mailman/listinfo/python-list
python finance
dailystockselect.com needs a couple of talented python people for the development and implementation of new trading strategies. it may be also some pythonic design change for the displayed figures now the web app consists of 1 of the 8 conceived strategies. contact us at the email on the website for more details Samir -- https://mail.python.org/mailman/listinfo/python-list
What does sys.stdout.flush() do?
Somewhere i read.. sys.stdout.flush(): Flush on a file object pushes out all the data that has been buffered to that point. Can someone post here a script example with sys.stdout.flush(), where in case i commented that i could understand what the difference really would be? Whenever i try to remove that line (in scripts that i find online), i cant find any differences. I've just noticed that it is usually called right after sys.stdout.write(..) thx -- http://mail.python.org/mailman/listinfo/python-list
Re: log incoming ip/porrt connections
This monitors also ip/port of incoming udp packets? Or just tcp after a connection has been enstablished? If i dont make any sense, plz correct me. Not much experience with networking here :) -- http://mail.python.org/mailman/listinfo/python-list
Re: log incoming ip/porrt connections
Or point me the right way in case this is not that simple to do. -- http://mail.python.org/mailman/listinfo/python-list
log incoming ip/porrt connections
Hi there. I have a script-service running on a remote server, listening on a specific port. What i need here is to make this also maintain a log file of ALL incoming connections. Could someone suggest to me a simple codefunction example to implement that on my main running service? THX!! -- http://mail.python.org/mailman/listinfo/python-list
Python 3.3 + QtSql + ssh tunnel - Connection problem
Im using python 3.3 on win7 64bit and trying to connect to a MySQL database on a remote server through a putty ssh tunnel. Running the script below im getting "Physical connection to the database did not activate!". What im i doing wrong?! I tried to find a working example but couldnt find one. thx in advance guys from PyQt5 import QtSql def main(): db = QtSql.QSqlDatabase.addDatabase("QMYSQL") db.setHostName("127.0.0.1") db.setPort(3306) db.setDatabaseName("username_databasename") db.setUserName(username) db.setPassword(userpassword) ok = db.open() if ok: print ("Physical connection to the database activated") else: print ("Physical connection to the database did not activate!") return create_table(db) db.close() main() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and SSH Tunnel
What about the security though? To be specific, i need to create an application (python 3.3 strictly) where users will save/load their settings online to a remote hosted database. I do not wish to change the database from listening to any other thing than localhost for security reasons, so i assume the best solution for me would be to make the program create some ssh tunnels before the saving/loading happens. But would this policy make my database (or the rest of the databases that im running on that machine) unsecure? Is there any workaround this? How would you do that online saving/loading? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and SSH Tunnel
> Alternatively, can you use PostgreSQL instead? :) Yes there is such an option to be honest. Would that be helpfull instead of MySQL? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 and SSH Tunnel
> > HOWTO anyone? > > > > > > What im trying to succeed here is create one SSH tunnel, so that i can > > connect from a python script running on my pc, to a remote MySQL database > > running on my Host and id like to stick with Python 3.3 . > > > > > > I contacted my host and he informed me that this is the only way. > > > > > > I tried pycrypto + paramiko but from what i have noticed, paramiko is not > > Python 3.3 ready. > > > > I'm not sure what exactly is going on here, but why not simply > > establish a tunnel using ssh(1) and then invoke your Python script > > separately? You simply point your script at a database on localhost, > > after establishing a tunnel from local 3306 to remote localhost:3306. > > No need to play with Python crypto. > > > > Alternatively, can you use PostgreSQL instead? :) > > > > ChrisA Yes you are right. I've played with putty to achieve this but to be honest i'd like something more efficient. Opening putty everytime and making all the connection settings etc, and then running the programm, is kinda messy. Id like this to be done in an automatic way from the program so that things roll easy. I thought maybe i should find a way how to call and run a batch file from inside my python program or a powershell command, but i do not know even if that could work for the ssh tunneling. any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Python 3 and SSH Tunnel
HOWTO anyone? What im trying to succeed here is create one SSH tunnel, so that i can connect from a python script running on my pc, to a remote MySQL database running on my Host and id like to stick with Python 3.3 . I contacted my host and he informed me that this is the only way. I tried pycrypto + paramiko but from what i have noticed, paramiko is not Python 3.3 ready. Any thoughts? -- http://mail.python.org/mailman/listinfo/python-list
Re: paramiko installation problem
Wow thats bad news. Any workaround? What im trying to succeed here is create one SSH tunnel, so that i can connect from a python script running on my pc, to a remote MySQL database running on my Host and id like to stick with Python 3.3 . Any thoughts? -- http://mail.python.org/mailman/listinfo/python-list
Re: paramiko installation problem
>>> import sys >>> print (sys.path) returns: ['C:\\Python33\\Lib\\idlelib', 'C:\\Python33\\lib\\site-packages\\pip-1.4-py3.3.egg', 'C:\\Windows\\system32\\python33.zip', 'C:\\Python33\\DLLs', 'C:\\Python33\\lib', 'C:\\Python33', 'C:\\Python33\\lib\\site-packages'] then if i type: >>> sys.path.append('C:\\Python33\\Lib\\site-packages\\paramiko') and then again.. >>> print (sys.path) returns: ['C:\\Python33\\Lib\\idlelib', 'C:\\Python33\\lib\\site-packages\\pip-1.4-py3.3.egg', 'C:\\Windows\\system32\\python33.zip', 'C:\\Python33\\DLLs', 'C:\\Python33\\lib', 'C:\\Python33', 'C:\\Python33\\lib\\site-packages', 'C:\\Python33\\Lib\\site-packages\\paramiko'] then if i type: >>> import paramiko i get this: Traceback (most recent call last): File "", line 1, in import paramiko File "C:\Python33\lib\site-packages\paramiko\__init__.py", line 64, in from transport import SecurityOptions, Transport File "C:\Python33\Lib\site-packages\paramiko\transport.py", line 296 except socket.error, e: ^ SyntaxError: invalid syntax -- when i close and reopen IDLE, then 'C:\\Python33\\Lib\\site-packages\\paramiko' is getting deleted. If my problem from the first post above has to do something with the path, then what exactly should i do? I would also like to ask here something extra.. :) in system enviroment variables my path contains the following things: C:\Python33\Lib\site-packages\PyQt5;C:\Python33\Scripts\;C:\Python33\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Python33\Lib\site-packages\paramiko;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\NEST;C:\Program Files (x86)\Windows Live\Shared so what exactly is the difference between this path and the above.? A huge THANKS for the one who will find the courage to answer to this newbie ! -- http://mail.python.org/mailman/listinfo/python-list
paramiko installation problem
Im having problems using paramiko after installation on my Win7 64bit system. I can see both paramiko and pycrypto being "there" installed via pip list: I have tried so many different ways but in the end im always getting the same error when trying to import paramiko: (i can import Crypto with no problems) Traceback (most recent call last): File "", line 1, in import paramiko File "C:\Python33\lib\site-packages\paramiko\__init__.py", line 64, in from transport import SecurityOptions, Transport ImportError: No module named 'transport' Please can you help? thx -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt5 and virtualenv problem
Any advice?Plz? -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt5 and virtualenv problem
Could you help me install PyQt5 properly in my Virtualenv folder and not only globally? I tried installing PyQt5 and sip with the use of pip but i was getting errors all the time (Why is that? Are there any known pip issues along with PyQt5 and sip?), so in the end i had to install it with the installer provided from the official riverbank website. However now, everytime i create a virtual enviroment, PyQT5 or sip package is not included there and i dont know how to solve this problem either. I tried applying this fix: http://stackoverflow.com/questions/1961997/is-it-possible-to-add-pyqt4-pyside-packages-on-a-virtualenv-sandbox , but i do not know if i have done things right. I can import PyQt5 and pip packages from within python console without any errors being showed (both globaly and inside my virtuall enviroment), so i could assume i did all ok. But should this confirmation be enough for me or is there any other way i could confirm that everything is indeed properly installed? I noticed that in start menu - programs, a new folder named "PyQt GPL v5.0 for Python v3.3 (x64)" had been created after the installation, where someone can find view PyQt examples and a PyQT Examples module which starts an application. Big question now.. Everytime i run PyQt Examples module from within global IDLE, everything works ok and then again when i close the application, this appears: Traceback (most recent call last): File "C:\Python33\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.pyw", line 91, in sys.exit(app.exec_()) SystemExit: 0 However, everytime i run PyQt Examples module from within virtual env IDLE, nothing happends. So as you can undertand, this is why i believe i have not installed properly PyQt5 or sip **(I start virtual env IDLE using this shortcut ""..path..\Python\Python Projects\PriceTAG Grabber\env\Scripts\pythonw.exe" C:\Python33\Lib\idlelib\idle.pyw") I know i may have asked too many questions in just a single topic, but all im trying to achieve here is to be sure that PyQt5 and virtual env are working fine. Thx for your time in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt5 and virtualenv problem
Answer here: http://stackoverflow.com/questions/1961997/is-it-possible-to-add-pyqt4-pyside-packages-on-a-virtualenv-sandbox -- http://mail.python.org/mailman/listinfo/python-list
PyQt5 and virtualenv problem
I tried to install SIP and PyQt5 using the pip install command but it didnt work on both cases (i was getting errors), so i finally installed them using the windows installers provided in riverbankcomputing website. My problem though here is that whenever i try to create a new virtualenv enviroment, those packages are not included and i cant import them. How can i add PyQt5 to my new virt enviroment? What is the logic behind this problem so i understand whats going on here? Thx in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: virtualenv problem
Yeah trying to run virtualenv under IDLE was a desperate move as i couldnt make anything work under cmd. Apparently my problem was that i did not have correctly setup the new path.. Solution for me was the following from "http://forums.udacity.com/questions/100064678/pip-installation-instructions"; -- ..We want to add that directory to your Path environment variable. Path is a list of directories where your OS looks for executable files. You will need to change the directory if you installed Python in a non-default location. a. go to Control Panel » System » Advanced » Environment Variables, make sure Path is selected under "user variables for user", and click edit. b. Add ;C:\Python33\Scripts\ and ;C:\Python33\ (no spaces after the previous entry, ';' is the delimiter) to the end of variable value, then click ok. You should not be erasing anything, just adding to what's already there. This just makes it so we don't have to type the full path name whenever we want to run pip or other programs in those directories. "C:\Python33\Scripts\" is the one we want now, but "C:\Python33\" might be useful for you in the future. Restart your computer. -- I realised that even if i didn't do the above, i could still have got things rolling just by cd-ing from the cmd, to the script folder of my Python installation. But hey - learning is a good thing -- http://mail.python.org/mailman/listinfo/python-list
virtualenv problem
Hi there. Im using windows 7 64bit I have installed python 3.3.2 in C:\Python33 and then easy_install , pip, and virtualenv. But i do not know if the virtualenv installation is correct as i cant seem to be able to create any virtual enviroment yet. How can i check if everything is correct? What exactly should i do to create a virtual enviroment into my new_project folder located here: in C:\new_project ? I think there is something wrong with the installation because when i run through idle the virtual-env scripts located in "C:\Python33\Scripts" then i get the following.. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> RESTART >>> You must provide a DEST_DIR Usage: virtualenv-3.3-script.py [OPTIONS] DEST_DIR Options: --version show program's version number and exit -h, --helpshow this help message and exit -v, --verbose Increase verbosity -q, --quiet Decrease verbosity -p PYTHON_EXE, --python=PYTHON_EXE The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 interpreter to create the new environment. The default is the interpreter that virtualenv was installed with (C:\Python33\pythonw.exe) --clear Clear out the non-root install and start from scratch --no-site-packagesDon't give access to the global site-packages dir to the virtual environment (default) --system-site-packages Give access to the global site-packages dir to the virtual environment --always-copy Always copy files rather than symlinking --unzip-setuptoolsUnzip Setuptools when installing it --relocatable Make an EXISTING virtualenv environment relocatable. This fixes up scripts and makes all .pth files relative --no-setuptools Do not install setuptools (or pip) in the new virtualenv. --no-pip Do not install pip in the new virtualenv. --extra-search-dir=SEARCH_DIRS Directory to look for setuptools/pip distributions in. You can add any number of additional --extra-search- dir paths. --never-download Never download anything from the network. This is now always the case. The option is only retained for backward compatibility, and does nothing. Virtualenv will fail if local distributions of setuptools/pip are not present. --prompt=PROMPT Provides an alternative prompt prefix for this environment --setuptools Backward compatibility. Does nothing. --distribute Backward compatibility. Does nothing. Traceback (most recent call last): File "C:\Python33\Scripts\virtualenv-3.3-script.py", line 9, in load_entry_point('virtualenv==1.10', 'console_scripts', 'virtualenv-3.3')() File "C:\Python33\lib\site-packages\virtualenv.py", line 786, in main sys.exit(2) SystemExit: 2 plz any help appreciated -- http://mail.python.org/mailman/listinfo/python-list
must be dicts in tuple
Hi, I am using Python with Bots(EDI translator) But i am getting the following error: MappingFormatError: must be dicts in tuple: get((({'BOTSID': 'HEADER'},),)) Can anyone pls help me with it. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: nimsg -- the Network Instant MeSsenGer
If you have any suggestions for features, bugs that you want to report, or just comments on the program in general, feel free to reply here. -- http://mail.python.org/mailman/listinfo/python-list
nimsg -- the Network Instant MeSsenGer
Some time ago, I posted the code to a p2p instant messaging program to this newsgroup. It was abandoned by me shortly after I posted (no reason, just wanted to work on other things). Anyways, I've worked on this program __a lot__ since I posted it here (including giving the program a name change). The program is now known as "nimsg -- the Network Instant MeSsenGer". So, I thought that I would give everybody here a link to the code: https://github.com/dryad-code/nimsg Features: Multiple people can chat at the same time (there is no limit), People can pick nicknames to use, and You can post multiple times in a row. nimsg can be used as an alternative for IRC, for those times that you just want to have a small, local chat room. nimsg was written in Python 2.7.3, and does not require any non-standard libraries or modules. Happy hacking! Hunter D -- http://mail.python.org/mailman/listinfo/python-list
Re: im.py: a python communications tool
I just put out a new version of im.py on GitHub. You can find it here: https://github.com/jhunter-d/im.py/blob/master/im.py -- http://mail.python.org/mailman/listinfo/python-list
New version
There's a new version of im.py out on GitHub: https://github.com/jhunter-d/im.py/blob/master/im.py -- http://mail.python.org/mailman/listinfo/python-list
Re: im.py: a python communications tool
On Apr 7, 6:36 pm, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 14:47:11 -0700, jhunter.dunefsky wrote: > > Actually, my current licence can be found here: > >https://github.com/jhunter-d/im.py/blob/master/LICENCE. Whaddaya think > > about this, Useneters? > > I think you're looking for a world of pain, when somebody uses your > software, it breaks something, and they sue you. Your licence currently > means that you are responsible for the performance of your software. > > Why don't you use a recognised, tested, legally-correct licence, like the > MIT licence, instead of trying to be clever and/or lazy with a one-liner? > > E.g.http://opensource.org/licenses/MIT > > Software licencing is a solved problem. Do you really think that people > write three or four paragraph licences because they *like* legal > boilerplate? Did you imagine that you were the first person to think, "I > know! I'll write a one-liner telling people they can do whatever they > want with my software! Nothing can possibly go wrong!"? > > Use a known, tested, working solution, and save yourself the pain. > > -- > Steven MIT is actually the best one I've seen so far. I'm updating LICENCE. -- http://mail.python.org/mailman/listinfo/python-list
Re: im.py: a python communications tool
On Apr 5, 8:52 pm, Demian Brecht wrote: > Thanks for sharing some of your work with the community. However... > > Speaking to the sharing aspect: Why would you post a block of code in an > email? If you're looking for people to contribute, it would likely be a > much better idea to post it on github (which was built for collaborative > work). > > As for the code itself, if you /know/ it sucks and are advertising it as > such, you're not really enticing people to work on it. In its current > state, it looks like a non-extensible prototype, just poking around to see > how you can achieve a p2p connectivity, without doing /any/ research > (supporting modules, etc) or design before just starting to throw something > together. > > I'd venture to say that the chances of actually getting anyone to > contribute to this in its current state (especially purely over a mailing > list) would be slim to none. People generally tend to want to see that > there's actually effort and thought put into something before they put > /their/ own time into it. Jeez, harsh. I __am__ putting this on github, and I __am__ coming back to this program and working on it now. -- http://mail.python.org/mailman/listinfo/python-list
Re: im.py: a python communications tool
On Apr 5, 9:26 pm, Andrew Berg wrote: > On 2013.04.05 20:07, Roy Smith wrote:> I know this is off-topic, but I > encourage people to NOT invent their own > > licenses. > > Perhaps he meant this existing license:http://www.wtfpl.net/about/ > -- > CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 Yep. As a matter of fact, I did. -- http://mail.python.org/mailman/listinfo/python-list
im.py: a python communications tool
Hey Usenetites! I have a horrible Python program to allow two people to chat with each other. It has horribly any functionality, but it is meant for the public to work on, not necessarily me. Anyways, here's a quick FAQ. What does this do that IRC can't? What does this do that AIM can't? --It allows direct communication between two computers, whereas IRC doesn't. And AIM and similar services require a username, etc. This is made specifically for two users on a network to chat. What version of Python is this written in? --Python 2.7.3. What is the licence? --It's released under a special FOSS licence. Here it is: You can do whatever you want with this program. Alright, now, here's the code: #!/usr/bin/python #An instant messaging program implemented in Python. #Created on Sunday, December 30, 2012 (long before it's Usenet publication) import socket import sys import threading def server_listen(): while True: r = c.recv(8192) if r == "\quit": c.close() s.close() sys.exit(0) print con_addr[0], ": " + r def client_listen(): while True: r = s.recv(8192) if r == "\quit": s.close() sys.exit(0) print sys.argv[1], ": " + r s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if sys.argv[1] == "-l": s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(('', 5067)) s.listen(5) c, con_addr = s.accept() while True: r = c.recv(8192) if r == "\quit": c.close() s.close() sys.exit(0) print con_addr[0], ": " + r i = raw_input("You: ") if i == "\quit": c.send("\quit") c.close() s.close() sys.exit(0) c.send(i) else: s.connect((socket.gethostbyname(sys.argv[1]), 5067)) print "Chat initiated with " + sys.argv[1] + "!" while True: i = raw_input("You: ") if i == "\quit": s.send("\quit") s.close() sys.exit(0) s.send(i) r = s.recv(8192) if r == "\quit": s.close() sys.exit(0) print sys.argv[1] + ": " + r I encourage people to modify this code, because really, it sucks. Enjoy! -- http://mail.python.org/mailman/listinfo/python-list
Re: Make python 3.3 the default one and not 2.7
thx solved -- http://mail.python.org/mailman/listinfo/python-list
Re: Make python 3.3 the default one and not 2.7
Τη Τετάρτη, 3 Απριλίου 2013 12:43:43 μ.μ. UTC+3, ο χρήστης Wolfgang Maier έγραψε: > D. Xenakis hotmail.com> writes: > > > > > > > > Hi there, i installed python 2.7 (windows 32bit version) from > > > http://www.enthought.com/products/epd_free.php and after that i installed > > official 3.3 version > > > too. So now i got two python folders like this.. c:/Python27 and > > c:/Python33 . > > > My problem is that when im trying to execute a .py file, the 2.7 version > > interpreter launces. In addition if i > > > right click and select Edit with IDLE, again version 2.7 interpreter opens. > > How can i make python 3.3 the > > > default one, as i need this cause i have PyQt4 installed there and so it > > does > > not work with 2.7 . > > > Thx in advance. > > > > > > > Check out the post at > > http://stackoverflow.com/questions/4664646/how-to-change-default-python-version-on-windows-xp > > . > > Especially the part about changing the registry. The Python.File entry > mentioned > > there also has the information about the IDLE version to use. > > Best, > > Wolfgang I changed this too Python.CompiledFile to my 33 version. Should i not touch this key? -- http://mail.python.org/mailman/listinfo/python-list
Re: Make python 3.3 the default one and not 2.7
I tried to reinstall python 3.3 but there was not change :(. I selected to run all component from my PC. I'll give it a try with those registries. -- http://mail.python.org/mailman/listinfo/python-list
Make python 3.3 the default one and not 2.7
Hi there, i installed python 2.7 (windows 32bit version) from http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version too. So now i got two python folders like this.. c:/Python27 and c:/Python33 . My problem is that when im trying to execute a .py file, the 2.7 version interpreter launces. In addition if i right click and select Edit with IDLE, again version 2.7 interpreter opens. How can i make python 3.3 the default one, as i need this cause i have PyQt4 installed there and so it does not work with 2.7 . Thx in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help installing latest PyQT
Τη Τρίτη, 2 Απριλίου 2013 10:44:43 μ.μ. UTC+3, ο χρήστης Sibylle Koczian έγραψε: > Am 02.04.2013 18:10, schrieb David Robinow: > > > > > > 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" > > > from http://www.riverbankcomputing.com/software/pyqt/download , > > > here: "C:\Python33" (It was the setup's default choice so i assumed > > > it was also the right one). > > > > > > Yes. > > > > > > > > > And thats it.. > > > > > > What should i do exactly now foks :) > > > > > > You should be done.Start an interactive python and enter: > > > >>>import PyQt4 > > > > > > If there's no traceback you're good to go. > > > > > > > I'd try one thing more from that interactive python prompt: > > > > from PyQt4 import QtCore > > from PyQt4 import QtGui > > > > Do you get tracebacks with this? (I do, that's why I ask.) > > > > The examples that come with the installation usually do both imports in > > one line, but for a first test this may be better: if you get an error, > > you see a little more. > > > > HTH > > Sibylle from PyQt4 import QtCore from PyQt4 import QtGui I get no error using those on IDLE 3.3 -- http://mail.python.org/mailman/listinfo/python-list
Re: Help installing latest PyQT
I had also installed in the past python 2.7 . Now when im trying to run a .py, interpreter 2.7 is always being called.. (also when im right clicking and sellecting to run in IDLE, 2.7 is agai n starting instead of 3.3) so PyQt4 is crashing. Any tip to make 3.3 the default interpreter plz? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help installing latest PyQT
Τη Τρίτη, 2 Απριλίου 2013 6:39:07 μ.μ. UTC+3, ο χρήστης D. Xenakis έγραψε: > Hi there im trying to install PyQT (version > PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i > have installed everything correctly. I tried to find documentation about this > but most links were very dead.. > > > > So far so good.. i have: > > 1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer" from > http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit Win7 pro > Greek edition) > > > > 2)Downloaded and unzipped "sip-4.14.5.zip" from > http://www.riverbankcomputing.com/software/sip/download , here: > "D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder > any further, cause i dont know what exactly i should do with that so > everything is get properly done..) I suppose after having it unzipped, i > should then move that somewhere (maybe here "C:\Python33") and then maybe run > some commands but.. help needed here so i dont do something wrong, as this > link http://goo.gl/UuLjz doesnt make that clear to me what exact steps i > should follow :( . > > > > 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from > http://www.riverbankcomputing.com/software/pyqt/download , here: > "C:\Python33" (It was the setup's default choice so i assumed it was also the > right one). > > > > And thats it.. > > > > What should i do exactly now foks :) > > Thx in advance -- http://mail.python.org/mailman/listinfo/python-list
Help installing latest PyQT
Hi there im trying to install PyQT (version PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i have installed everything correctly. I tried to find documentation about this but most links were very dead.. So far so good.. i have: 1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer" from http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit Win7 pro Greek edition) 2)Downloaded and unzipped "sip-4.14.5.zip" from http://www.riverbankcomputing.com/software/sip/download , here: "D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder any further, cause i dont know what exactly i should do with that so everything is get properly done..) I suppose after having it unzipped, i should then move that somewhere (maybe here "C:\Python33") and then maybe run some commands but.. help needed here so i dont do something wrong, as this link http://goo.gl/UuLjz doesnt make that clear to me what exact steps i should follow :( . 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from http://www.riverbankcomputing.com/software/pyqt/download , here: "C:\Python33" (It was the setup's default choice so i assumed it was also the right one). And thats it.. What should i do exactly now foks :) Thx in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Help. HOW TO guide for PyQt installation
Τη Τετάρτη, 20 Μαρτίου 2013 2:55:22 π.μ. UTC+2, ο χρήστης Terry Reedy έγραψε: > On 3/19/2013 8:12 PM, D. Xenakis wrote: > > > Hi there, Im searching for an installation guide for PyQt toolkit. To > > > be honest im very confused about what steps should i follow for a > > > complete and clean installation. Should i better choose to install > > > the 32bit or the 64bit windows version? > > > > I am rather sure you should match your Python installation. > > > > > If i installed this > > > package on windows 8, should i have any problems? From what i read > > > PyQt supports only xp and win7. > > > > If the PyQT author(s) say nothing about Win8, I would presume that they > > have not tested it. Do you really want to be a guinea pig? > > > > > I was thinking about installing the > > > newer version of PyQt along with the QT5. > > > > Does PyQT 'say' that it works with QT5? If so, try it. > > > > -- > > Terry Jan Reedy http://www.riverbankcomputing.co.uk/news Yes from their news Yes i'll better stay same version as python. Im just asking as my new laptop has win8 on that and even though i got a linux partition on that, id rather not install a win7 partition too :D. I'll give it a try what the hek. maybe there is a win7 compability mode or win7image option inside win 7 anyway. I know i cant expect a guide how to as everything is quite new here, but .. im just searching for some guidelines here. I have download and installed already "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x32-2.exe Windows 32 bit installer" out from this website http://www.riverbankcomputing.co.uk/software/pyqt/download , in my start menu there is a new folder named "PyQt GPL v4.10 for Python v3.3 (x32)" but when i run Designer and go to about tab it only says: Qt Assistant Version 5.0.1 Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). Would that be normal? Shouldn't i also see somewhere anything about PyQt.. :P And last but not least.. ive noticed in the Riverbank's website this notice "Before you can build PyQt you must have already built and installed SIP" I havent done that.. What exactly will happend now, that i have not installed that yet. What would the conflict be (im asking more so that i can understand how this helps). Thx 4 your time guys just by reading this! -- http://mail.python.org/mailman/listinfo/python-list
Help. HOW TO guide for PyQt installation
Hi there, Im searching for an installation guide for PyQt toolkit. To be honest im very confused about what steps should i follow for a complete and clean installation. Should i better choose to install the 32bit or the 64bit windows version? Or maybe both? Any chance one of them is more/less bug-crashy than the other? I know both are availiable on the website but just asking.. If i installed this package on windows 8, should i have any problems? From what i read PyQt supports only xp and win7. I was thinking about installing the newer version of PyQt along with the QT5. I have zero expirience on PyQt so either way, everything is going to be new to me, so i dont care that much about the learning curve diference between new and old PyQt - Qt version. I did not find any installer so i guess i should customly do everything. Any guide for this plz? Id also like to ask.. Commercial licence of PyQt can only be bought on riverbank's website? I think i noticed somewhere an other reseller "cheaper one" or maybe i didnt know what the hell i was reading :). Maybe something about Qt and not PyQt. Please help this noob, Regards -- http://mail.python.org/mailman/listinfo/python-list