Re: [Tutor] Python Challenge Online - 30 Questions

2018-03-01 Thread Tim Golden
On 01/03/2018 14:36, Julien Carlier wrote: Hi Tim, I didn't send this message to several groups. I sended this message to 20 people from the same group. I will take care to choose relevant groups. What is considered good form? Regards, Julien Replied off-list TJG ___

Re: [Tutor] Python Challenge Online - 30 Questions

2018-03-01 Thread Tim Golden
On 01/03/2018 13:36, Julien Carlier wrote: Cisco & Dimension Data organize a Python Challenge on EDITx. It is a good way to test your skills & have fun. [... snip ...] You've just cross-posted this to several Python mailing lists / newsgroups, some of them certainly irrelevant. This is not co

Re: [Tutor] Resources/Books for teaching OOP in Python and Tkinter

2017-02-20 Thread Tim Golden
On 19/02/2017 16:34, Marie Shaw via Tutor wrote: I am a teacher of 16-18 year olds. Since September, my classes have been learning to program in Python, using all of the basics in console mode. I now need to teach them OOP using Python, and GUI programming using Python. Please could someone one p

Re: [Tutor] Resending question with smaller file

2017-02-13 Thread Tim Golden
On 13/02/2017 16:06, Lisa Hasler Waters wrote: Hello Python Tutor, We are trying to use the random function in the Tkinter module in PyCharmEDU 3.5. (on Macs running 10.11.6). However, we get a number of error messages: Here's the code: from tkinter import * import random tk = Tk() canvas = C

Re: [Tutor] Program won't print out in Windows 10

2016-07-24 Thread Tim Golden
On 24/07/2016 16:38, Ken G. wrote: While the following program prints out fine using Python 2.7.6 in Ubuntu 14.04.4 as developed using Geany 1.23.1, same program won't print out to printer under Windows 10 Pro (64 bit). Geany uses there is version 1.28 using Python 2.7.12. I can use CTRL-P t

Re: [Tutor] Urgent: unicode problems writing CSV file

2016-06-08 Thread Tim Golden
On 08/06/2016 14:54, Alex Hall wrote: > All, > I'm working on a project that writes CSV files, and I have to get it done > very soon. I've done this before, but I'm suddenly hitting a problem with > unicode conversions. I'm trying to write data, but getting the standard > cannot encode character: o

Re: [Tutor] Curses Module

2016-05-16 Thread Tim Golden
On 15/05/2016 22:45, Rosen, Brian - 2016 wrote: > To Whom it May Concern, > > > I am a high school student currently enrolled in an Intro to Computer > Programming Class. In my current assignment, I would like to import > the curses module into either Python 2.7 or Python 3.4. However, > whenever

Re: [Tutor] using a for loop in another method

2016-04-22 Thread Tim Golden
On 22/04/2016 17:08, Rene.Castillo wrote: Hi, this is my first post on this mailing list- I wanted to ask about this type of execution in python, expected output- reverse_words("This is an example!") # returns "sihT si na !elpmaxe" below is my execution, followed by another persons execution

Re: [Tutor] Help with python

2016-04-19 Thread Tim Golden
On 19/04/2016 10:03, Alan Gauld wrote: However, for now, you probably want to use IDLE which should come with Python. (It is sometimes called Python GUI on Windows too.) You should find it under Python in your All Programs view. In any recent version of Windows (ie Vista & later) the most comm

Re: [Tutor] PLEASE I NEED HELP URGENTLY

2016-01-13 Thread Tim Golden
On 13/01/2016 20:51, Tim Golden wrote: Speaking as the list moderator in question over there: if I might moderate Mark's well-known zeal... (Absolutely no pun intended!) TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] PLEASE I NEED HELP URGENTLY

2016-01-13 Thread Tim Golden
On 13/01/2016 20:44, Mark Lawrence wrote: On 13/01/2016 18:13, Alan Gauld wrote: On 13/01/16 17:53, Mark Lawrence wrote: This is beyond a joke. The main mailing list is all ready being moderated because of the constant messages asking for help on this presumably homework question. Can these b

Re: [Tutor] indent error on if/elif/else

2015-09-10 Thread Tim Golden
On 10/09/2015 16:38, richard kappler wrote: > Here's my code, no tabs were used, all whitespace verified made with > spacebar: > > print("Please enter a number for feed speed...") > print("1 - Batch") > print("2 - 2 per second") > print("3 - Real Time") > print("4 - Exit") > > if x == ord('1'): >

Re: [Tutor] educational

2014-03-09 Thread Tim Golden
On 09/03/2014 17:06, Alan Gauld wrote: On 09/03/14 10:37, Peter Otten wrote: In this case, I'm fairly sure the line producing this error is:: image = Image.open("logo.jpg") And Python is correct, the ‘Image’ type has no ‘open’ attribute. What There are a few things around called `Image

Re: [Tutor] Advice on Python codes - A recursive function to output entire directory subkeys of Windows Registry

2014-02-05 Thread Tim Golden
On 05/02/2014 15:30, Alan Ho wrote: Hi, I am a novice in Python, having attended a course few weeks ago and I'm working on my assignment now, and I encounter this issue when I was trying to print the entire Windows Registry (WR) sub-keys directories (trying that first with the below codes with a

Re: [Tutor] my modules idle doesn't list functions python3.3

2014-02-05 Thread Tim Golden
On 05/02/2014 11:53, Ian D wrote: > Hi > > In Python 2.7 > > If I create my own modules and call them with > > import sys > sys.path.append("d:\modules") > > import myMod > > and use tab to autocomplete I get a list functions. > myMod.< if I tab this I get a list of my functions >

Re: [Tutor] sys.path.append import python3 not working

2014-02-05 Thread Tim Golden
On 05/02/2014 11:55, Ian D wrote: > The network dictates that it is the only way I can really do it as I > cannot edit any files directly. I have to append the path on the fly Ok; just wanted to make sure you weren't making life more difficult for yourself than needs be. TJG

Re: [Tutor] sys.path.append import python3 not working

2014-02-05 Thread Tim Golden
On 05/02/2014 11:58, Oscar Benjamin wrote: > Another option is to place it in site-packages. If you don't want to > use the system site packages you can always use the one in your user > directory. In my case on Ubuntu that's in > ~/.local/lib/pythonX.Y/site-packages/ Good point: I always forget t

Re: [Tutor] sys.path.append import python3 not working

2014-02-05 Thread Tim Golden
On 05/02/2014 11:46, Ian D wrote: > Ok even more strangely it is working in the original location. > > Am now not 100% sure that I have the folder structure correct. > > I will keep a eye on it. You might want to consider whether your approach is the best. One usually appends to sys.path when

Re: [Tutor] getUncPath(mappedDrive)

2014-01-30 Thread Tim Golden
On 30/01/2014 11:39, Tim Golden wrote: > On 29/01/2014 21:58, danz wrote: >> Tim. >> >> I came across your code while searching for a similar need. Your post was >> the best I could find on the subject. Perhaps more importantly, you showed >> me that going down t

Re: [Tutor] getUncPath(mappedDrive)

2014-01-30 Thread Tim Golden
On 29/01/2014 21:58, danz wrote: > Tim. > > I came across your code while searching for a similar need. Your post was > the best I could find on the subject. Perhaps more importantly, you showed > me that going down the ctypes rabbit hole can be less intimidating than I > assumed. Thanks! [The

Re: [Tutor] Expenses

2013-12-02 Thread Tim Golden
On 02/12/2013 14:49, Alan Gauld wrote: > Is there any point to this random set of data? > Do you have a question for us? I assumed it was a mis-posted email that should have gone to some house-share group email but instead went to python-tutor. The OP's probably lying low out of embarrassment :)

Re: [Tutor] keyboard interrupt

2013-10-17 Thread Tim Golden
On 17/10/2013 16:36, Bill wrote: > > I know, way late to the party... > > Did you try Ctrl-Break? In Windows that is usually how you interrupt a > program... Take consolation from the fact that your five-month delay in replying isn't even close to the longest delay I've seen on a Python list. S

Re: [Tutor] sqlite3 COMMIT directive

2013-10-01 Thread Tim Golden
On 01/10/2013 11:41, Tim Golden wrote: > You're sort-of correct. What happens is that the database doesn't enter > autocommit mode (you'll still need to specify the right isolation level > on the .connect for that). Rather, the __exit__ method of the > connection-as

Re: [Tutor] sqlite3 COMMIT directive

2013-10-01 Thread Tim Golden
On 01/10/2013 11:28, Alan Gauld wrote: > On 01/10/13 09:25, Tim Golden wrote: >> On 01/10/2013 09:03, Alan Gauld wrote: >>> You don't normally need to use COMMIT when programming SQLite from >>> Python, the database starts and ends transactions automatically from &

Re: [Tutor] sqlite3 COMMIT directive

2013-10-01 Thread Tim Golden
On 01/10/2013 09:03, Alan Gauld wrote: > You don't normally need to use COMMIT when programming SQLite from > Python, the database starts and ends transactions automatically from > within the execute() function. You only need to manually commit if you > manually create the transaction using BEGIN..

Re: [Tutor] hard time importing a module

2013-04-19 Thread Tim Golden
On 19/04/2013 17:12, eryksun wrote: > On Fri, Apr 19, 2013 at 11:52 AM, Tim Golden wrote: >> As usual, the excellent Christoph Gohlke has provided binaries for a >> range of targets: >> >> http://www.lfd.uci.edu/~gohlke/pythonlibs/ > > Maybe you missed th

Re: [Tutor] hard time importing a module

2013-04-19 Thread Tim Golden
On 19/04/2013 16:39, eryksun wrote: > On Fri, Apr 19, 2013 at 11:12 AM, Oscar Benjamin > wrote: >> Did these files also come with a file called setup.py? >> >> Normally, a Python module is not installed by manually copying the >> files to the appropriate places but by running 'python setup.py >> i

Re: [Tutor] Need help on win32 application error

2013-04-02 Thread Tim Golden
On 02/04/2013 19:19, ankesh.pra...@cognizant.com wrote: I am facing folowing erro while executing python code: Win32 exception occurred releasing IUnknown at 0x03210eb8 You need to give us a bit more of a clue as to what your code does. My guess is that you're using the p

Re: [Tutor] There's a Programmer in Me

2013-02-26 Thread Tim Golden
On 26/02/2013 13:54, Mark Lawrence wrote: > On 26/02/2013 13:02, Khalid Al-Ghamdi wrote: >> Hi All, >> >> I'm not a programmer by profession, but I want to learn python. I've got >> lots of Ideas that want to realize, but I always run into these >> stupid hiccups where I follow the tutorials and so

Re: [Tutor] ImportError

2012-07-31 Thread Tim Golden
On 31/07/2012 15:32, Tino Dai wrote: > Hi All, > >I have been banging my head against a wall trying to figure it > out. I'm getting a ImportError on a > class that I know exists. I'm wondering if there is some dark corner of > the import mechanism that Try running python with the -v para

Re: [Tutor] Opening filenames with unicode characters

2012-06-28 Thread Tim Golden
On 28/06/2012 20:48, James Chapman wrote: The name of the file I'm trying to open comes from a UTF-16 encoded text file, I'm then using regex to extract the string (filename) I need to open. OK. Let's focus on that. For the moment -- although it might well be very relevant -- I'm going to igno

Re: [Tutor] Opening filenames with unicode characters

2012-06-28 Thread Tim Golden
On 28/06/2012 18:19, James Chapman wrote: Hi there python list. I'm trying to open a text file named "This is_a-test'FILE to Ensure$ that£ stuff^ works.txt" (without the quotes) but I'm struggling to find a way to open it. Happily, you're using Windows, which makes this very much easier. Shor

Re: [Tutor] Writing to Windows 64-bit event log

2012-06-19 Thread Tim Golden
On 19/06/2012 06:37, Johan Geldenhuys wrote: > I've looked all over, but couldn't find any help as far as an API goes > to log to a 64-bit Windows7 machine event log. There are functions available in the pywin32 package under the win32evtlog module. I have wrapped some of them in my winsys packag

Re: [Tutor] Opensource projects / Subversion

2012-04-08 Thread Tim Golden
On 08/04/2012 16:07, Steven D'Aprano wrote: mjole...@gmail.com wrote: Hey everyone, I finally made my way into working on Opensource projects. I installed tortoisesvn. I included command line tools when running the installer. However when I invoke svn at command line, I get the following error:

Re: [Tutor] Permissions Error

2012-03-27 Thread Tim Golden
On 27/03/2012 05:00, Michael Lewis wrote: Traceback (most recent call last): File "C:\Python27\Utilities\copyfiles.py", line 47, in copyfiles(srcdir, dstdir) File "C:\Python27\Utilities\copyfiles.py", line 42, in copyfiles shutil.copy(srcfile, dstfile) File "C:\Python27\lib\sh

Re: [Tutor] getUncPath(mappedDrive)

2012-03-25 Thread Tim Golden
On 25/03/2012 09:12, Albert-Jan Roskam wrote: Thank you so much for this! I think this would also be a valuable addition to os.path (where I'd expect it to be). You call WNetGetConnection twice: one time with a 'dummy' string buffer, and one time with a buffer of the exact require

Re: [Tutor] getUncPath(mappedDrive)

2012-03-24 Thread Tim Golden
On 24/03/2012 21:29, Albert-Jan Roskam wrote: Thanks! This seems a feasible approach. I have found this Python project that exposes some of the functions of mpr.dll: http://sourceforge.net/projects/wnetconnect/ WNetGetConnection is not among the functions, but the code will help.

Re: [Tutor] getUncPath(mappedDrive)

2012-03-24 Thread Tim Golden
On 24/03/2012 20:13, Albert-Jan Roskam wrote: Hi, Is there a function that takes a file path with a mapped drive (z:\blah) and returns the associated UNC path (\\server\share\ding\dang\dong\blah)? I looked in os.path, but it doesn't seem to have this. The link below seems to be a solution (code

Re: [Tutor] Which computer operating system is best for Python developers?

2012-02-23 Thread Tim Golden
On 23/02/2012 09:00, Alan Gauld wrote: By no means, one of Pythons strengths is that the same code can run on many OS. But as Steven has mentioned many developers use Linux because GNU/Linux is designed as a developer's OS and comes with oodles of tools. Most of those are available for Windows to

Re: [Tutor] how to find index of list with its value

2011-12-08 Thread Tim Golden
On 08/12/2011 15:28, surya k wrote: Well, we all know to know the value when we have the index of a list. But how can we find it in the reverse way... say a listl=[1,2,3,4] l[0]=1.but how can I find its address with its value 1 ?? help ([]) ... index(...) L.index(value, [start, [stop]])

[Tutor] Fwd: Re: [python-win32] Handling a Unicode Return using Pyodbc

2011-11-15 Thread Tim Golden
[cc-ing back to the *correct* list in case other readers find it helpful...] On 15/11/2011 15:16, Tony Pelletier wrote: Thanks, Tim! This is working brilliantly Slow, but working..:) I can go from here and see if there's a way to speed it up. Well you've got a few options, although an am

Re: [Tutor] Handling a Unicode Return using Pyodbc

2011-11-15 Thread Tim Golden
On 14/11/2011 21:43, Tony Pelletier wrote: Good Afternoon, I'm writing a program that is essentially connecting to MS SQL Server and dumping all the contents of the tables to separate csv's. I'm almost complete, but now I'm running into a Unicode issue and I'm not sure how to resolve it. I hav

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-09-29 Thread Tim Golden
On 29/09/2011 15:22, lina wrote: I want to read a bunch of *.doc file in present working directory, how can I use for to read one by one and do further work, sorry, what's the best reference webpage I can use? I googled, lots of distracting info, and I barely can understand how they think.

Re: [Tutor] Using xml.etree

2011-09-19 Thread Tim Golden
On 19/09/2011 11:01, Tim Golden wrote: you're more likely to find people familiar with the package (including its maintainer in fact...) Sorry, I misread your post and thought you were referring lxml.etree (which is a 3rd-party lib). My basic point still stands, though: you'll get mo

Re: [Tutor] Using xml.etree

2011-09-19 Thread Tim Golden
On 19/09/2011 10:46, lists wrote: Hello again. So, any xml.etree experts out there who might have missed this over the weekend? Not me, I'm afraid, but might I suggest that you ask on the mail Python list: http://mail.python.org/mailman/listinfo/python-list There's nothing wrong with askin

Re: [Tutor] python Module for Windows Active Directory

2011-07-28 Thread Tim Golden
On 28/07/2011 07:28, qbits...@gmail.com wrote: Hi, Which is the best package/module in Python to work with Windows Active Directory? I may need to create multiple OUs, set different users and computers and fill their individual attributes. Later i may need to modify/delete and then may need to

Re: [Tutor] cpython

2011-05-12 Thread Tim Golden
On 12/05/2011 14:10, tee chwee liong wrote: hi all, i just started python but i'm hearing there is cpython. what is it different from python? is there any tutorials i can refer. CPython is just the most common version of Python, so-called because it's written in C: the one you download from py

Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Tim Golden
To confirm: Python does *nothing* to convert automatically from one form of path separator to another. Windows from very early on, has accepted /-slashes as path separators to API calls. Where they don't work is: at the command shell itself presumably since slashes are commonly used to introduce o

Re: [Tutor] Alternate credentials

2011-05-04 Thread Tim Golden
On 04/05/2011 00:18, Alan Gauld wrote: Since its more a Windows question than a Python one I suggest you try a Windows forum. comp.python.windows might be worth a try? Or even the ctypes group? While we do have some Windows users here its not really a python nwewbie type question. True enough.

Re: [Tutor] Alternate credentials

2011-05-03 Thread Tim Golden
On 03/05/2011 5:35 PM, Bill Allen wrote: I am needing to run a Python networked application with a specific set of credentials, Windows AD, rather than the user's own so that the app can access the needed CIFS shares. Where should I start? By saying what operating system you're running on, whi

Re: [Tutor] win32com and python

2011-04-19 Thread Tim Golden
On 19/04/2011 15:53, Pierre Barthelemy wrote: The problem i have is that, often, while the script is running, the powerpoint file would already be open. In this case, my script would open it anew, and make the modifications in the newly opened file. To prevent that problem, i need to be able to l

Re: [Tutor] Problem recognizing '{' character?

2011-03-29 Thread Tim Golden
On 29/03/2011 09:41, Peter Otten wrote: Ben Hunter wrote: Hi, I'm completing the Python lessons on YouTube that Google posted. At the end of section 2 of day 2, there is a task to identify files then put them in a zip file in any directory. The code is from the 'solution' folder, so it's not s

Re: [Tutor] Replying

2011-03-29 Thread Tim Golden
On 28/03/2011 23:17, Steven D'Aprano wrote: Corey Richardson wrote: Thunderbird has a "reply list" button that I use. It does? What version are you using? Also, if you're a keyboard person, Ctrl-Shift-L (Win7, TB 3.1.9) TJG ___ Tutor maillist -

Re: [Tutor] CSV Ouptut concern...

2011-03-17 Thread Tim Golden
On 17/03/2011 11:56, Dipo Elegbede wrote: i wrote a code for extracting information from a csv file into another csv file. it worked well but i have an immediate challenge i can't seem to fix. the new file that is created has an row and then an empty row and then a row all through the file. how c

Re: [Tutor] CSV to Excel

2011-03-17 Thread Tim Golden
On 16/03/2011 17:12, Susana Iraiis Delgado Rodriguez wrote: Thank you for your help! Once I read your comments I tried both corrections in my code, but none of them we're sucessful. Ok, Susana, your problem (here) is the use of the csv module so can I suggest we back away from your wider progr

Re: [Tutor] CSV to Excel

2011-03-11 Thread Tim Golden
On 11/03/2011 8:59 PM, Susana Iraiis Delgado Rodriguez wrote: Hello list!! I'm trying to write a CSV file to work it with Excel. My python script is working, the issue is: when I import the file from excel the data comes with quotes at the beginnig and ending of the row. I don't want to have the

Re: [Tutor] Using the console module.

2011-03-11 Thread Tim Golden
On 11/03/2011 08:12, DistortGiygas wrote: Python users, what's the best option for someone trying to emulate or use the curses module on the Windows platform? I've been fooling around with the console module: effbot.org/zone/console-handbook.htm But for the life of me, I can't figure out how to

Re: [Tutor] Alternatives to pymssql to work with MS SQL Server

2011-03-02 Thread Tim Golden
On 02/03/2011 09:22, Emmanuel Ruellan wrote: I installed Python 2.6 and pymssql on a machine, but as soon as I import pymssql, it crashes. It looks like this is a known problem: http://code.google.com/p/pymssql/issues/detail?id=2 What alternatives to pymssql do you recommend? I just want to be

Re: [Tutor] pywin32 help

2011-01-30 Thread Tim Golden
On 30/01/2011 6:42 AM, walter weston wrote: hello I am running python 2.7 , I am trying to install pywin32 version 2.7 when I run the setup.py file a black console windows pops up displays some text and dissappears before I can read any of the text . I dont know what says so I cant give details

Re: [Tutor] Print to std output with color

2011-01-26 Thread Tim Golden
On 26/01/2011 6:10 PM, Scott Nelson wrote: Curses is one way to go. Another is to use the PyWin32 module discussed in this thread: http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454 Basically, here's a snippet of code that can get you started. This requires that you have the Py

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread Tim Golden
On 17/01/2011 18:35, Bill Allen wrote: Tim, Thanks for posting this. I have several uses for this WMI module at my work. Glad it's useful... TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pyt

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread Tim Golden
On 17/01/2011 03:01, FT wrote: Is there a way to read the battery level using Python? I am totally blind and want to write a script to capture the battery level and send it through the voice activeX so I can speak it... WMI should be able to query the battery information: import wmi c = wmi

Re: [Tutor] Change Font Size when print to screen

2011-01-11 Thread Tim Golden
On 11/01/2011 09:03, tee chwee liong wrote: When I do print "Hello World", it will print to the cmd window with the standard font size. Is there a way we can increase the font size to larger when print out to the cmd window? I'm going to assume that you're using Windows, since you refer to the

Re: [Tutor] Displaying picture and Text

2010-11-04 Thread Tim Golden
On 04/11/2010 04:24, pa...@cruzio.com wrote: Hi - I am running Python 2.6.6 on my HP netbook with Windows 7. The default picture viewer is set to HP Photo Viewer. I am working on a part of my python program where a picture is supposed to display with a few lines of text below it. Ideally, I wou

Re: [Tutor] 2.6 vs 2.7: package compatibility?

2010-10-25 Thread Tim Golden
It tells me that persistent_dict does not exist, when it clearly does. Another user had the exact same problem when running the source on 2.6, but he had no problem when running 2.7. If you had an msi to install Durus for 2.6 specifically, it would be interesting to see if the persistent_dict erro

Re: [Tutor] 2.6 vs 2.7: package compatibility?

2010-10-25 Thread Tim Golden
On 25/10/2010 02:20, Alex Hall wrote: Hi all, I want to run a certain program from source. One dependency, Durus, keeps giving me an error that no one can figure out. Someone said that it will work if I use 2.7 instead of 2.6, but a lot of packages I have installed work only on 2.6. I know I can

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-21 Thread Tim Golden
On 21/10/2010 13:42, Richard D. Moores wrote: Traceback (most recent call last): File "c:\P26Working\test_urllib2_21a.py", line 148, in unchanged_count, higher_count, lower_count, secs = sleep_seconds_control(unchanged_count, higher_count, lower_count, secs) TypeError: 'int' object is not

Re: [Tutor] I am looking for a book on Beginners who never programmed before or have no experience in programming

2010-09-29 Thread Tim Golden
On 29/09/2010 12:20, Calle's Pyt(h)onkonto wrote: Or if you're like me (= Thinks reading a guide online is annoying since you have to switch between your browser and IDLE all the time), and would like to have a book that is easy to read and easy to understand, Merely from that perspective alone

Re: [Tutor] console output that is same in Python 2 and 3

2010-09-28 Thread Tim Golden
On 27/09/2010 17:11, Thierry Tung wrote: Hello tutor at python.org. How can I write strings to the console in a way that will give the same result in Python 3 and Python 2? I tried sys.stdout.write('hello') on Microsoft vista. with python 3.1.2 sys.stdout.write('hello') hello5 with py

Re: [Tutor] Windows Printing, Round 2

2010-09-23 Thread Tim Golden
On 23/09/2010 7:18 PM, Rance Hall wrote: Again I'm referencing Tim Golden from http://timgolden.me.uk/python/win32_how_do_i/print.html This code block is relevant: import os, sys import win32print printer_name = win32print.GetDefaultPrinter () # # raw_data could equally be raw PCL/PS

Re: [Tutor] Windows printing

2010-09-23 Thread Tim Golden
On 23/09/2010 14:05, Rance Hall wrote: For the first roll-out and testing I figured plaintext was good enough. Future revisions will probably use the PDF library you also referred to on your page. Either way that is as printer ready as I expect I will be able to get it. One option you might w

Re: [Tutor] Windows printing

2010-09-23 Thread Tim Golden
On 23/09/2010 07:30, Rance Hall wrote: I'm using this page as a reference: http://timgolden.me.uk/python/win32_how_do_i/print.html I'm able to print to the default printer ok, but I can't seem to find out how to get to pick the printer I want to use. This is from a CLI app, so there is no gui.

Re: [Tutor] Can't process all my files (need to close?)

2010-09-20 Thread Tim Golden
On 20/09/2010 16:19, aenea...@priest.com wrote: My Python script needs to process 45,000 files, but it seems to blow up after about 10,000. Note that I'm outputting bazillions of rows to a csv, so that may be part of the issue. Here's the error I get (I'm running it through IDLE on Windows 7):

Re: [Tutor] os.access unreliable?

2010-08-25 Thread Tim Golden
On 25/08/2010 11:15, Steven D'Aprano wrote: It also warns that os.access doesn't take into account network file sharing permissions. Heh. On Windows it doesn't take into account *any* file sharing permissions :) TJG ___ Tutor maillist - Tutor@pytho

Re: [Tutor] os.access unreliable?

2010-08-25 Thread Tim Golden
On 25/08/2010 09:28, Albert-Jan Roskam wrote: Hi, Hi I'm using os.access to do a preliminary check to see if I have RW access, but it seems to be unreliable. In a dir for which I have only read access, os.access also says I have write access. This is under Windows 2000. I could of course use a t

Re: [Tutor] Module for browsing Windows?

2010-08-11 Thread Tim Golden
On 11/08/2010 01:17, Chorn, Guillaume wrote: Hello, I'm pretty new to Python programming and it is my first programming language. I made a script that uses data from two different .csv files to make calculations and then spit the results out in a third .csv file. However, the process of typing

Re: [Tutor] os.urandom()

2010-08-10 Thread Tim Golden
On 10/08/2010 15:33, Steven D'Aprano wrote: On Tue, 10 Aug 2010 02:24:00 pm Dave Angel wrote: [...] Any suggestions how to fix the Windows console to interpret utf8? There are several tracker issues relating to this one. The current position seems to be: it's not easy. I've done no more than

Re: [Tutor] how to do excel in python

2010-08-05 Thread Tim Golden
On 05/08/2010 15:08, invincible patriot wrote: hi, can any one tell me how can I access MS excel worksheet in python and how can I access itz individual cells..?? http://www.python-excel.org/ (First hit for python excel in Google) TJG ___ Tuto

Re: [Tutor] need help with msvcrt.getch()

2010-07-27 Thread Tim Golden
On 27/07/2010 15:22, Richard D. Moores wrote: Python 3.1 on Vista. Please see. I'm trying to recall what I used to know, thus this simple script. But 'y' or 'q' do nothing. What's wrong? msvcrt.getch returns bytes on Python 3.1; you're comparing against

Re: [Tutor] Strange sqlite3 behavior

2010-07-17 Thread Tim Golden
On 17/07/2010 8:10 AM, Lang Hurst wrote: I just had the weirdest issue with sqlite3. I was trying to update a field to "Active". I have a little database of students and sometimes they get sent to juvi, or just check out for a couple of months and show back up. Anyway, I wanted to just have a

Re: [Tutor] (no subject)

2010-06-30 Thread Tim Golden
On 30/06/2010 17:20, Aaron Chambers wrote: I'm new to Python, and wanted to start messing around with it, but the computer I'm using is running Windows 7, so is there a version of Python that's compatible with 7? Yes. I'm running versions from Python 2.1 all the way up to the latest 2.x and 3.x

Re: [Tutor] upgrade from 2.6.2 to 2.6.5?

2010-06-22 Thread Tim Golden
On 22/06/2010 13:40, Alex Hall wrote: Hi all, I am having problems with the Durus package, and I was told that changing Python versions might help. Most of the other dependencies of the project I have are 2.6 only, so I do not want to change versions from 2.6.x, but I would like to try upgrading

Re: [Tutor] Programming microsoft excel

2010-05-07 Thread Tim Golden
On 06/05/2010 17:51, hbu...@ovi.com wrote: Hi guys can i use python's win32com module to do the same tasks that i do with visual basic for applications (vba). I mean automating tasks for excel e.t.c and accessing Access databases. If win32com doesnt which module can i use? You want to look at t

Re: [Tutor] Remote access from Windows PC to a Linux box

2010-03-31 Thread Tim Golden
On 30/03/2010 17:29, Mike Baker wrote: I'm trying to connect to a Linux box from my Windows machine and execute a series of commands I want a script to always execute the same series of commands without having to do so manually. I also have code that will execute a single command like cat a fi

Re: [Tutor] browing windows registry

2010-03-17 Thread Tim Golden
On 17/03/2010 02:35, Jeff Peery wrote: hello, I want to browse the windows registry for the program ids listed under the categories: 63D5F430-CFE4-11d1-B2C8-0060083BA1FB 63D5F432-CFE4-11d1-B2C8-0060083BA1FB where might be the best way to learn how to do that with python? Hopefully this might

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread Tim Golden
On 25/02/2010 15:18, Michael M Mason wrote: ALAN GAULD wrote on 25 February 2010 at 08:50:- So I think that was a red herring, sorry. It also looks like the Read Only check box in the main Explorer property dialog tab doesn't mean what it says... Doesn't the Read Only checkbox have a coloured

Re: [Tutor] SYS Long File Names?

2010-02-07 Thread Tim Golden
On 06/02/2010 21:36, FT wrote: I was looking at the sys.argv(1) file name and it is the short 8 char name. How do you place it into the long file name format? I was reading music files and comparing the name to the directory listing and always comes back as not found because the name was sho

Re: [Tutor] What is URL to online Python interpreter?

2009-12-18 Thread Tim Golden
Scott Nelson wrote: On Thu, Dec 17, 2009 at 09:32:44PM -0800, Benjamin Castillo wrote: What is URL to online Python interpreter? There is also http://codepad.org/ which also supports lots of languages (Python, Ruby, Perl, PHP, C/C++...). Pretty slick. You can also use it as a public pastebi

Re: [Tutor] faster substring replacement

2009-12-15 Thread Tim Golden
Luhmann wrote: Hi folks, I'm trying to do something like this: evildict= {'good' : 'bad' , 'love' : 'hate' , 'God': 'Satan'} def make_evil(text) ...for a in evildict: ... text=text.replace(a, evildict[a]) ... return text This works fine, but it soon

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Tim Golden
biboy mendz wrote: Lie and Tim's input are true that raw_input doesnt do anything or you cant catch exception error from it. And i'm wrong in placing the try-except clause, it should be on the fobj-open line. But im still looking for the exception that will be raised when i input a filename an

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Tim Golden
biboy mendz wrote: http://pastebin.ca/1693849 This is end-of-chapter3 exercise of the book Core Python Programming. I'm reading/searching in the book and other materials but is unsuccessful. There are at least 50 exceptions listed but I can't find anything close. I commented out my modified

Re: [Tutor] Use of 'or'

2009-11-17 Thread Tim Golden
Stephen Nelson-Smith wrote: A friend of mine mentioned what he called the 'pythonic' idiom of: print a or b Isn't this a 'clever' kind or ternary - an if / else kind of thing? I would say it's perfectly idiomatic in Python, but not as a ternary. If you want a ternary use the (relatively) rece

Re: [Tutor] Classes that do operator overloading

2009-11-07 Thread Tim Golden
Hugo Arts wrote: On Sat, Nov 7, 2009 at 12:25 PM, C.T. Matsumoto wrote: class indexer(): def ___getitem__(self, index): return index ** 2 I thought I was missing some special style, or rule. The class above is take from Learning Python, and there are several other examples too. fo

Re: [Tutor] trouble using 2to3.py

2009-11-04 Thread Tim Golden
Dave Angel wrote: I've thought of using hard links (using fsutil.exe, in case anyone else is interested), but I keep my scripts and batch files, as well as small utilities on a separate drive partition from the one that has my OS and installed programs. And hard links don't work across separa

Re: [Tutor] trouble using 2to3.py

2009-11-03 Thread Tim Golden
Richard D. Moores wrote: On Tue, Nov 3, 2009 at 05:30, Dave Angel wrote: (Erasing entire history, since you both top-posted, and it's too confusing) When you run a xxx.py on Windows, it locates the python.exe using the registry entries set up by assoc and ftype. But when you run "python" it

Re: [Tutor] New to Python

2009-10-29 Thread Tim Golden
asteri...@petlover.com wrote: I am running Windows Vista. OK. Definite points for giving useful info up front. Do you know what remote desktop is? Yes. This is the tool I use to connect to my other severs on the network or alternatively I use my "Run" option (Start/Run) where you add in

Re: [Tutor] introspecting an object for method's name?

2009-10-19 Thread Tim Golden
Kent Johnson wrote: On Sunday, October 18, 2009, Serdar Tumgoren wrote: Hi everyone, I'm trying to create a generic logging function, and I'm able to get at the name of the module and class using the built-in attributes __module__, __class__, and __name__. But I wasn't sure how to also grab th

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-15 Thread Tim Golden
Katt wrote: Hello all, I am currently using WinXP and python 2.6.2 I just installed PyWin32 v214 for python 2.6 from the following link: [... snip lots of advice from other people ...] Hi, Katt. Thanks for posting back over here. I must admit, I hadn't realised you were posting to the tutor l

Re: [Tutor] Changing text colors on WinXP py2.6.2

2009-10-13 Thread Tim Golden
Mark Tolonen wrote: "Tim Golden" wrote in message news:4ad471e6.7050...@timgolden.me.uk... Alan Gauld wrote: "Tim Golden" wrote No. ANSI escapes don't work on Windows. Wouldn't the ANSI codes work if ANSI.SYS were loaded? I thought you could still load AN

Re: [Tutor] Changing text colors on WinXP py2.6.2

2009-10-13 Thread Tim Golden
Alan Gauld wrote: "Tim Golden" wrote No. ANSI escapes don't work on Windows. Wouldn't the ANSI codes work if ANSI.SYS were loaded? I thought you could still load ANSI.SYS it just wasn't normally there? The help system says you should load it in config.nt with:

  1   2   3   >