Re: Is there a way to programmatically turn on remote registry?

2012-10-22 Thread Tim Golden
On 22/10/2012 16:38, Kevin Holleran wrote: Thanks, I will look into that. WMI is enabled, but everything WMI query I wrote (& I am NOT a WMI expert or even close) gave me a bunch of NIC info, but not the info I am after in the registry (driver description, driver date, driver version for the

Re: Is there a way to programmatically turn on remote registry?

2012-10-22 Thread Tim Golden
On 22/10/2012 15:51, Kevin Holleran wrote: > Back at it this morning. The RPC was due to needing to run it under > another account (or so I think now...). However, the RemoteRegistry > service is not just STOPPED but DISABLED. > > I am trying to see if there is a call to actually set the state to

Re: Python on Windows

2012-10-19 Thread Tim Golden
On 19/10/2012 15:23, Mark Lawrence wrote: > On 19/10/2012 14:44, Tim Golden wrote: >> >> (In general, PyPI is the first place to look for Python packages). >> >> > > For the benefit of the OP and others this is worth reading on how to get > Python packag

Re: Python on Windows

2012-10-19 Thread Tim Golden
[Could I suggest snipping some of the preceding replies unless you're referring directly to them? Just leave enough to make the context clear] [... attempts to find feedparser module for beginner's tutorial ...] On 19/10/2012 15:12, graham wrote: > Once again thanks to those that replied. > > Si

Re: Python on Windows

2012-10-19 Thread Tim Golden
On 19/10/2012 14:24, graham wrote: > Python was installed in the subdirectory C:\Python27 with the file > feedparser.py residing in C:\Python27\Lib\email. > > Setting the Windows environment variable (which did not previously > exist) to C:\Python27\Lib\email allowed me to import feedparser > succ

Re: Python on Windows

2012-10-19 Thread Tim Golden
On 19/10/2012 14:24, graham wrote: > Thanks to everyone who replied. > > Python was installed in the subdirectory C:\Python27 with the file > feedparser.py residing in C:\Python27\Lib\email. > > Setting the Windows environment variable (which did not previously > exist) to C:\Python27\Lib\email a

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-09-11 Thread Tim Golden
On 11/09/2012 04:46, Steven D'Aprano wrote: > On Mon, 10 Sep 2012 15:22:05 -0700, ruck wrote: > >> On Monday, September 10, 2012 1:16:13 PM UTC-7, Steven D'Aprano wrote: > [...] >>> That's not so much a workaround as the officially supported API for >>> dealing with the situation you are in. Why d

Re: Filter versus comprehension (was Re: something about split()???)

2012-08-25 Thread Tim Golden
On 25/08/2012 13:57, David Robinow wrote: On Fri, Aug 24, 2012 at 3:03 PM, Walter Hurry wrote: On Fri, 24 Aug 2012 14:29:00 -0400, Dennis Lee Bieber wrote: It appears to be a change Google made in the last month or two... My hypothesis is that they are replacing hard EOL found in inbound NNTP

Re: Running Python web apps on shared ASO servers?

2012-08-12 Thread Tim Golden
On 12/08/2012 21:52, Gilles wrote: On Sun, 12 Aug 2012 07:56:26 +0200, Dieter Maurer wrote: You should probably read the mentioned forum resources to learn details about the Python support provided by your web site hoster. Yup, but so far, no answer, so I figured someone here might now. Thos

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 10:50, rahul wrote: > When I use same code base for Python 3.x, then behavior is different. In this > when I return false then also it throws exception but only when any other > statement get executed after this > > like below code: > ... > ... >b = None >try: > a =

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 10:21, rahul wrote: > > Hi TJG, > > The above link also doesn't strictly said that return value should be > NULL only, it only said that usually NULL pointer used. No where I > saw that it is nessasory t > > At http://docs.python.org/c-api/exceptions.html. it is written that > "Mos

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 09:57, rahul wrote: > I am implementing a C extension module, during this I saw that when I > set the global error indicator and error message through > PyErr_SetString() API and return false. > > But it doesn't throw any error when I tried to check the error > through sys.exc_info()

Re: Recruiting for Python Developer - Perm

2012-05-22 Thread Tim Golden
Someone will soon pop up and tell you that job ads are unwelcome on this list and that you should post to the Python Jobs board --> http://www.python.org/community/jobs/ However, the python-uk list is probably a better place for UK-focused jobs, as long as you have something which is definitely Py

Re: is this foolish?

2012-04-12 Thread Tim Golden
On 12/04/2012 10:35, Cameron Simpson wrote: > I've found myself using a Python gotcha as a feature. Have a look at Peter Inglesby's lightning talk from a recent London Python Dojo: http://inglesp.github.com/2012/03/24/mutable-default-arguments.html TJG -- http://mail.python.org/mailman/listin

Re: Python is readable

2012-03-15 Thread Tim Golden
On 15/03/2012 14:19, Kiuhnm wrote: On 3/15/2012 15:06, Mark Lawrence wrote: On 15/03/2012 11:48, Kiuhnm wrote: BTW, aren't those ':' redundant? Kiuhnm Nope. Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" fo

Re: Windows Contextmenu

2012-03-13 Thread Tim Golden
On 13/03/2012 09:41, Szabo, Patrick (LNG-VIE) wrote: I wrote the following Script which I want to run from the open with contextmenu in Windows. For that purpose I used py2exe to make an exe out of it. [... snip ...] Now the script runs fine but I don’t get all arguments from sys.argv. No

Re: check if directory is writable in a portable way

2012-02-28 Thread Tim Golden
On 28/02/2012 12:01, Andrea Crotti wrote: On 02/28/2012 11:34 AM, Tim Chase wrote: On 02/28/12 04:07, Andrea Crotti wrote: How should I check if I can create files in a directory? So maybe the only solution that works is something like try: open(path.join('temp', 'w')) except OsError: return F

Re: check if directory is writable in a portable way

2012-02-28 Thread Tim Golden
On 28/02/2012 10:07, Andrea Crotti wrote: How should I check if I can create files in a directory? I tried to simply check if the directory is writeable with this function: def is_writable(name): """Return true if the file is writable from the current user """ return os.access(name, os.W_OK) b

Re: Cycle around a sequence

2012-02-08 Thread Tim Golden
On 08/02/2012 08:26, Mark Lawrence wrote: On 08/02/2012 01:26, Dennis Lee Bieber wrote: On Wed, 08 Feb 2012 01:10:28 +, Mark Lawrence wrote: I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before com

Re: Can't write to a directory made w/ os.makedirs

2012-01-02 Thread Tim Golden
On 02/01/2012 03:14, David Goldsmith wrote: Here's my script, in case that helps: It certainly does. A few things occur to me. First, you shouldn't need to double-quote the path; the subprocess.call should do that for you as long as you're using the list version of the param -- which you are.

Re: Can't write to a directory made w/ os.makedirs

2012-01-01 Thread Tim Golden
On 01/01/2012 12:05, David Goldsmith wrote: >> ie can the Python process creating the directories, > > Yes. > >> and a subprocess called from it create a simple file? > > No. > >> Depending on where you are in the filesystem, it may indeed >> be necessary to be running as administrator. But don't

Re: [Windows 7, Python 2.6] Can't write to a directory made w/ os.makedirs

2012-01-01 Thread Tim Golden
On 31/12/2011 22:13, OlyDLG wrote: > Hi! I'm working on a script utilizing os.makedirs to make directories > to which I'm then trying to write files created by exe's spawned w/ > subprocess.call; I'm developing in Stani's Python Editor, debugging > using Winpdb. I've gotten to the point where >

Re: modifying a time.struct_time

2011-12-16 Thread Tim Golden
On 16/12/2011 10:44, Steven D'Aprano wrote: [ on time.struct_time ] Not a bug, but it does seem a very old and inelegant API more suited to hairy C programmers gathered around a smokey fire in a cave chewing on old dinosaur bones, and not worthy of space-age Python coders flying around on anti-g

Re: automate commands to an .exe console program through python

2011-12-13 Thread Tim Golden
On 13/12/2011 11:21, Juan Perez wrote: Well, if developers have to change something to the code, I'd continue with autoit, since is closer to real enviroment. You are right, autoit work by send parametres to GUI focused, but really I don't think it's something necessary for my purposes as I need

Re: subprocess.Popen under windows 7

2011-12-09 Thread Tim Golden
On 09/12/2011 08:32, Ulrich Eckhardt wrote: Am 08.12.2011 23:41, schrieb Frank van den Boom: arglist = [PATH_TO_7ZIP,"a", "-sfx", archive_name, "*", "-r", "-p",PASSWORD] The "*" is resolved by the shell, this is not a wildcard that gets passed to the program. At least not normally, your case m

Re: order independent hash?

2011-11-30 Thread Tim Golden
On 30/11/2011 12:32, Neal Becker wrote: I like to hash a list of words (actually, the command line args of my program) in such a way that different words will create different hash, but not sensitive to the order of the words. Any ideas? How about? hash (frozenset ("hello world".split ()))

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-25 Thread Tim Golden
On 25/11/2011 10:37, Ulrich Eckhardt wrote: Am 25.11.2011 04:49, schrieb alex23: On Nov 24, 6:51 pm, Tim Golden wrote: The Ctrl-Z thing is what *exits* the interpreter on Windows (a la Ctrl-D on Linux). With ActivePython, Ctrl-D works as well, which is a godsend as I'm constantly wo

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-25 Thread Tim Golden
On 25/11/2011 03:47, alex23 wrote: Tim Golden wrote: The interpreter inherits the command shell's history function: Open a cmd window and then a Python session. Do some stuff. Ctrl-Z to exit to the surrounding cmd window. Do some random cmd stuff: dir, cd, etc. Start a second Python se

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-24 Thread Tim Golden
On 24/11/2011 06:22, Chris Angelico wrote: On Thu, Nov 24, 2011 at 5:11 PM, Steven D'Aprano wrote: One of us is confused, and I'm pretty sure it's you :) Tim went on to say "Obviously this only applies when an underlying cmd session persists", which I understood as implying that he too is usi

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Tim Golden
On 23/11/2011 10:29, Steven D'Aprano wrote: On Wed, 23 Nov 2011 11:23:19 +0200, Anssi Saari wrote: goldtech writes: Using Windows. Is there a python shell that has a history of typed in commands? Is there a shell that doesn't have history then? At least both the vanilla shell and Idle both

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-16 Thread Tim Golden
On 16/11/2011 03:38, goldtech wrote: Hi, Using Windows. Is there a python shell that has a history of typed in commands? Have a look at DreamPie: http://dreampie.sourceforge.net/ TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Multilevel dicts/arrays v. tuples as keys? [Was: Re: Get keys from a dicionary]

2011-11-14 Thread Tim Golden
On 14/11/2011 10:05, Matej Cepl wrote: Dne 11.11.2011 14:31, macm napsal(a): def Dicty( dict[k1][k2] ): When looking at this I returned to the question which currently rolls in my mind: What's difference/advantage-disadvantage betweeng doing multi-level dicts/arrays like this and using tuple

Re: spawnl issues with Win 7 access rights

2011-10-28 Thread Tim Golden
On 27/10/2011 20:53, Terry Reedy wrote: On 10/27/2011 6:36 AM, Tim Golden wrote: On 27/10/2011 11:27, Propad wrote: the suggestion to add the optional second parameter fixed the problem, spawnl now works on the Win 7 computer I'm responsible for (with Python 2.2). So the suggested cause

Re: spawnl issues with Win 7 access rights

2011-10-27 Thread Tim Golden
On 27/10/2011 11:27, Propad wrote: the suggestion to add the optional second parameter fixed the problem, spawnl now works on the Win 7 computer I'm responsible for (with Python 2.2). So the suggested cause seems to be right. FWIW, although it's not obvious, the args parameter to spawnl is inte

Re: spawnl issues with Win 7 access rights

2011-10-26 Thread Tim Golden
On 26/10/2011 02:11, Terry Reedy wrote: OP reports 2.6 with XP works. Where do you see that, Terry? (Or was there an offlist email?) Did that use VS 2005? Maybe C runtime changed (regressed). That's possible -- and is essentially my main guess (faute de mieux). I've got the same results on

Re: spawnl issues with Win 7 access rights

2011-10-25 Thread Tim Golden
On 25/10/2011 08:01, Propad wrote: Thnx again for all the answers. As stated before, I'm limited in my options. One of them just might be to switch to Python 2.5, rewrite the code that crashes using the subprocess module, and then somehow patch the library I use (which I'm not suposed to do, but.

Re: spawnl issues with Win 7 access rights

2011-10-24 Thread Tim Golden
On 24/10/2011 14:18, Tim Golden wrote: I ran this (on Python 2.7 on Win7): import os os.spawnl (os.P_NOWAIT, r"c:\windows\notepad.exe") and Python crashed hard! Long time since I've seen that happen. This may or may not be related to what you're seeing but it's d

Re: spawnl issues with Win 7 access rights

2011-10-24 Thread Tim Golden
On 24/10/2011 13:43, Propad wrote: Hello everybody, I have some trouble with a program I run both on a WinXP and on Win 7. It boils down to this several lines: import os vePath = r'C:\Programme\RA Consulting_Webservices\DiagRA-MCD \DiagRA_D.exe' #vePath = r'C:\Windows\notepad.exe' process_id = o

Re: Python based silent installer, how to?

2011-10-20 Thread Tim Golden
On 20/10/2011 09:45, Muhammad Bashir Al-Noimi wrote: On 20/10/2011 01:35 ص, Alec Taylor wrote: Just download the msi (script is available to regenerate yourself) and run it with the silent swtich, something like: msiexec /x nameofmsi.msi Sorry I didn't explain what I'm looking for exactly. I'

Re: COM / .NET

2011-10-20 Thread Tim Golden
On 20/10/2011 09:06, Uffe Kousgaard wrote: Is python able to access COM libraries or .NET assemblies? If both, which is the easist or most popular? You have a few choices in this regard: * CPython can access COM objects either via the pywin32 extensions[1] or via comtypes[2]. The former is mai

Re: Thread handling issue

2011-10-09 Thread Tim Golden
On 08/10/2011 11:51, Paul wrote: I think I'll wait for the user to actually make a change after cancelling the output selection, in case they go straight back without making changes. If they make a change I think I'll try what you suggested and send off a new thread, and send an event to the prev

Re: Working with spreadsheet files

2011-10-09 Thread Tim Golden
On 09/10/2011 07:30, Yaşar Arabacı wrote: Does anyone know a good tutorial about working with Spreadsheet files (e.g. excel files) with Python. I have found xlutils, but there doesn't seem to be any documentation or tutorial about it that I could find. So, any suggestions? http://www.python-exc

Re: Thread handling issue

2011-10-07 Thread Tim Golden
On 07/10/2011 11:15, Paul wrote: My first thought was to use a flag but wouldn't the new thread see the cancel flag and stop as well? I could set it back but then any other threads might have been busy and not seen it while the flag was on. The thread goes through the selection and does a few qu

Re: Thread handling issue

2011-10-07 Thread Tim Golden
On 07/10/2011 09:29, Paul wrote: I'm wondering what the best solution for this problem is. I've got a wxpython app, in one part a user makes some selections then opens a dialog to select where to output. At which point the app starts a thread processing their selection while they're choosing an

Re: Deleting files on a shared server

2011-10-07 Thread Tim Golden
On 07/10/2011 02:14, Josh English wrote: This is a follow-up to some questions I posted a month or two ago. I have two programs running on various Windows XP boxes, sharing several resource files on a Windows 2003 server. It's a mapped drive on the workstations to a shared folder. I am using a l

Re: Detecting Ctrl-Alt-Del in Windows

2011-09-02 Thread Tim Golden
Obviously, this is a windows-based question. I know that Ctrl-Alt-Del is handled deep inside the OS, and I'm not trying to interrupt that. But is there some way to detect that a C-A-D has been pressed? Others have pointed out that this shouldn't really be possible for reasons of security. (And

Re: Setting the time in Win7

2011-08-23 Thread Tim Golden
On 22/08/2011 20:42, Bob Greschke wrote: Several people have been hacking away on this computer we are testing on, so I'm not sure what settings -- other than all of them -- have been messed with, but popen("time ...") seems to work, but system("time ...") does not. I'm going to restore the machi

Re: Setting the time in Win7

2011-08-22 Thread Tim Golden
If memory serves, you need to enable a specific privilege to set the time in Vista+. Just a moment... Have a look here: http://support.microsoft.com/kb/300022 and look for SeSystemtimePrivilege generally. Sorry; I'm a bit rushed at the moment. Feel free to post back if that isn't clear TJG

Re: To cmd.exe

2011-08-22 Thread Tim Golden
On 22/08/2011 14:21, aba ca wrote: How can I send to cmd.exe "netstat -an"? Look at the subprocess module, and especially the .check_output convenience function: http://docs.python.org/library/subprocess.html#subprocess.check_output TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: List spam

2011-08-18 Thread Tim Golden
On 18/08/2011 13:58, Jason Staudenmayer wrote: I really like this list as part of my learning tools but the amount of spam that I've been getting from it is CRAZY. Doesn't anything get scanned before it sent to the list? I haven't seen any significant quantity of spam on the list for ages. (Th

Re: How to Check Write Access of a Folder on Windows

2011-08-17 Thread Tim Golden
On 16/08/2011 13:38, Ayaskant Swain wrote: Hi Tim, Thanks for your reply. It seems this issue is related to python bug -http://bugs.python.org/issue2528 But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path& check it'

Re: Windows service in production?

2011-08-17 Thread Tim Golden
On 16/08/2011 15:46, snorble wrote: Interesting. Normally I would use py2exe then do "myapp.exe -install" to install the app as a service. How do you handle installing the service? Also what does the service show under the properties, for the executable? "python.exe script.py" or something else?

Re: Windows service in production?

2011-08-16 Thread Tim Golden
On 16/08/2011 05:32, snorble wrote: Anyone know of a Python application running as a Windows service in production? I'm planning a network monitoring application that runs as a service and reports back to the central server. Sort of a heartbeat type agent to assist with "this server is down, go c

Re: How to Check Write Access of a Folder on Windows

2011-08-12 Thread Tim Golden
On 12/08/2011 11:41, Ayaskanta Swain wrote: Hi, I have a requirement where I need to check the write permissions on a directory on Windows platform. I don’t want to use the python function os.access( ), since it does not work correctly on Windows. It is giving incorrect results to me. Another o

Re: Directions on accessing shared folder in windows network

2011-08-11 Thread Tim Golden
On 10/08/2011 21:43, Christian Heimes wrote: Am 10.08.2011 21:52, schrieb Ameet Nanda: Hi, Can anyone point me to a way to access windows shared folders from the network using a python script. I tried accessing using open, which is mentioned to work perfectly on the web, but it gives me followi

Re: PyWhich

2011-08-05 Thread Tim Golden
On 05/08/2011 14:51, Steven D'Aprano wrote: Tim Chase wrote: On 08/04/2011 07:34 PM, Steven D'Aprano wrote: Billy Mays wrote: #!/usr/bin/python I believe the recommended, platform independent hash-bang line is #!/usr/bin/which python I think you mean #!/usr/bin/env python Doh! I

Re: Require information on python API for Subversion related work

2011-08-02 Thread Tim Golden
On 02/08/2011 14:02, Shambhu Rajak wrote: I need an api that can be used to do following operations on Subversion repository tool: 1.Create branch 2.Check out 3.Check in 4.Merge http://pysvn.tigris.org/ (which is, by the way, the first Google hit for "Python Subversion bindings") TJG -

Re: How to get a dateiled process information on windows?

2011-07-01 Thread Tim Golden
On 01/07/2011 21:06, Leandro Ferreira wrote: I need to write an application that monitors the memory consumption of a process, there is some library that facilitates this work? I searched on google found nothing more interesting. Have a look at WMI TJG -- http://mail.python.org/mailman/listinf

Re: windows 7 create directory with read write execute permission for everybody

2011-06-27 Thread Tim Golden
On 26/06/2011 21:57, Gelonida wrote: Hi, What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. The reason I am asking is, that I'd like to create a directory structure where multiple

Re: User Authentication

2011-06-23 Thread Tim Golden
On 23/06/2011 16:07, Anurag wrote: My application is a web based application for both windows and Linux. The web part is developed using Django. So if Python does not support it then any support for local sytem account authentication in Django? I am looking for a common library for both Linux an

Re: Python 2.7 and cmd on Windows 7 64 (files lost)

2011-06-23 Thread Tim Golden
On 23/06/2011 09:08, Thorsten Kampe wrote: * Tim Golden (Thu, 23 Jun 2011 08:31:26 +0100) Certain commands, including "dir" and "copy" are not executables in their own right, but merely subcommands of cmd.exe. Right, "internal commands". You've got two o

Re: User Authentication

2011-06-23 Thread Tim Golden
On 23/06/2011 06:02, Anurag wrote: On Jun 22, 7:01 pm, Adam Tauno Williams wrote: On Wed, 2011-06-22 at 06:34 -0700, Anurag wrote: Hi All, I am working on application which needs to do a authentication against LDAP, if LDAP not installed then local system account (administrator user in windo

Re: Python 2.7 and cmd on Windows 7 64 (files lost)

2011-06-23 Thread Tim Golden
On 23/06/2011 07:33, Michel Claveau - MVP wrote: Hi! (sorry for my bad english...) On Win 7 64 bits: Command-Line CD \Python27 dir C:\Windows\System32\SoundRecorder.exe:==> OK Python.exe import os os.system("dir C:\\Windows\\System32\\SoundRecorder.exe") ==> Do not found t

Re: connect windows share

2011-06-22 Thread Tim Golden
On 22/06/2011 19:38, Travis Altman wrote: I want to be able to connect to a windows share via python. My end goal is to be able to recursively search through windows shares. I want to do this in Linux as well. So given a share such as \\computer\test I would like to search through the test dir

Re: User Authentication

2011-06-22 Thread Tim Golden
On 22/06/2011 14:34, Anurag wrote: Hi All, I am working on application which needs to do a authentication against LDAP, if LDAP not installed then local system account (administrator user in windows and root user in Linux). This should work on both Windows and Linux. Which library I should use

Re: SQL Server 2008R2 databases via Python 2.7 and Windows XP and higher

2011-06-17 Thread Tim Golden
On 17/06/2011 16:01, pyt...@bdurham.com wrote: Looking for some real-world advice on what is the best way to access MS SQL Server 2008R2 databases via Python 2.7 running under Windows XP, Vista, and Windows 7 and Windows Server 2005 and 2008. Based on my research, here's my list of choices: mxODB

Re: How do you copy files from one location to another?

2011-06-17 Thread Tim Golden
On 17/06/2011 06:06, John Salerno wrote: Based on what I've read, it seems os.rename is the proper function to use, but I'm a little confused about the syntax. Basically I just want to write a simple script that will back up my saved game files when I run it. So I want it to copy a set of files/d

Re: File access denied after subprocess completion on Windows platform

2011-05-25 Thread Tim Golden
On 24/05/2011 21:18, Claudiu Nicolaie CISMARU wrote: Now. There is one more issue. Seems that on faster computers and/or Windows 7 (the Win32 thing I have tested on a HVM Xen machine with Windows XP) the os.rename is too fast after fp.close() and generates the same Exception. The code follows: c

Re: Obtaining a full path name from file

2011-05-25 Thread Tim Golden
On 25/05/2011 07:36, Ulrich Eckhardt wrote: RVince wrote: s = "C:\AciiCsv\Gravity_Test_data\A.csv" f = open(s,"r") How do I obtain the full pathname given the File, f? Apart from the issue that the 'name' attribute is only the name used to open the file, there is another issue, though not on

Re: Obtaining a full path name from file

2011-05-24 Thread Tim Golden
On 24/05/2011 17:04, RVince wrote: Ha! You;re right -- but is there a way to get it without the filename appended at the end? Well, just use the functions in os.path, specifically os.path.dirname... TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Obtaining a full path name from file

2011-05-24 Thread Tim Golden
On 24/05/2011 16:36, RVince wrote: s = "C:\AciiCsv\Gravity_Test_data\A.csv" f = open(s,"r") How do I obtain the full pathname given the File, f? (which should equal "C:\AciiCsv\Gravity_Test_data"). I've tried all sorts of stuff and am just not finding it. Any help greatly appreciated ! You're

Re: os.access giving incorrect results on Windows

2011-05-24 Thread Tim Golden
On 20/05/2011 12:26, Ayaskanta Swain wrote: > Thanks for the reply and suggestions. I followed the patch provided by > you in issue 2528, but the code looks very tricky to me. OK, first a summary of the discussion on the python-dev thread. Essentially it was felt that os.access was sufficiently s

Re: File access denied after subprocess completion on Windows platform

2011-05-24 Thread Tim Golden
On 24/05/2011 11:01, Claudiu Nicolaie CISMARU wrote: The problem appears when I close the called program (in our case calc.exe). The (1) part (the call of os.rename) raise an exception: (32, 'The process cannot access the file because it is being used by another process') [Error 32] The process

Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Tim Golden
On 24/05/2011 09:31, Cathy James wrote: dear mentor, I need help with my code: 1) my program won't display file contents upon opening #1) open file and display current file contents: f = open ('c:/testing.txt'', 'r') f.readlines() If you're running this in an interactive interpreter, I would

Re: Problem in using subprocess module and communicate()

2011-05-23 Thread Tim Golden
[cc-ing back to the list; please keep the conversation over there...] On 23/05/2011 13:11, vijay swaminathan wrote: What I want to achieve is, I want to run a batch file on a command prompt. The reason for using thread is not for running multiple scripts simultaneously. It is just to monitor my

Re: Problem in using subprocess module and communicate()

2011-05-23 Thread Tim Golden
On 21/05/2011 16:56, vijay swaminathan wrote: I'm having some problem in using the communicate() along with the subprocess.I would like to invoke a command prompt and pass on a .bat file to execute. I went through the subprocess module and understood that using communicate, we can send the send

Re: List of WindowsError error codes and meanings

2011-05-20 Thread Tim Golden
On 20/05/2011 18:56, Andrew Berg wrote: This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? WindowsError is so broad that it could be difficult to decide what to do in an except clause. Fortunately, sys.exc_info()[1][0] holds the speci

Re: os.access giving incorrect results on Windows

2011-05-20 Thread Tim Golden
On 20/05/2011 09:21, Tim Golden wrote: [... re os.access on Windows ...] (Sorry; just got back to this this morning). I might raise this on python-dev. If you want to follow, my post is here: http://mail.python.org/pipermail/python-dev/2011-May/111530.html TJG -- http://mail.python.org

Re: os.access giving incorrect results on Windows

2011-05-20 Thread Tim Golden
On 19/05/2011 21:40, Andrew Berg wrote: On 2011.05.19 03:08 PM, Tim Golden wrote: * A R_OK check always succeeds if the file's attributes can be read at all So is this the same as F_OK then, or does it return false if the user isn't allowed to read permissions? * A W_OK check fa

Re: os.access giving incorrect results on Windows

2011-05-19 Thread Tim Golden
On 19/05/2011 20:56, Andrew Berg wrote: On 2011.05.19 02:43 PM, Tim Golden wrote: This is basically issue2528 [1]. The problem is that, although Windows (and Python) expose a version of os.access to match the Posix function, the meaning is so far removed on Windows as to be useless. Does this

Re: os.access giving incorrect results on Windows

2011-05-19 Thread Tim Golden
On 19/05/2011 20:37, Ayaskanta Swain wrote: Please help me in solving this issue. I want to check the write permissions on a directory on windows from my python script. I tried to use *os.access(dirpath, os.W_OK)*to check whether the user has write access or not, but it gives me incorrect result

Re: where to find shared python script?

2011-05-17 Thread Tim Golden
On 17/05/2011 13:53, Yue Chao wrote: I am new to python and thank you for your help! the first question is, is there any resource online where we can find shared python script (like reading a csv file for ready plot making, I know to use csv module while I find it's not good enough) . I don't k

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 20:23, Jun Hu wrote: Thanks for the tip, it is really helpful! however the class of Win32_NetworkAdapterConfiguration doesn't include the interface type (you can NOT tell if it is a wifi interface), so I change the code a bit like following: import wmi wlan_int_id=None for nic in

Re: Get the IP address of WIFI interface

2011-05-15 Thread Tim Golden
On 15/05/2011 12:04 PM, Neal Becker wrote: Far.Runner wrote: Hi python experts: There are two network interfaces on my laptop: one is 100M Ethernet interface, the other is wifi interface, both are connected and has an ip address. The question is: How to get the ip address of the wifi interface

Re: Assistance in understanding the sub-Process module

2011-05-13 Thread Tim Golden
On 13/05/2011 12:03, vijay swaminathan wrote: 1. The class definition as per the documentation is: /class /subprocess.Popen(/args/, /bufsize=0/, /executable=None/, /stdin=None/, /stdout=None/, /stderr=None/, /preexec_fn=None/, /close_fds=False/, /shell=False/, /cwd=None/, /env=None/, /universal_n

Re: Need Assistance on this program.

2011-05-13 Thread Tim Golden
On 13/05/2011 06:22, vijay swaminathan wrote: Hi Tim., Thanks.. This works as I had expected. are there any documentation for the subprocess.call method? I tried going through the python doc but could not narrow down. http://docs.python.org/library/subprocess.html?highlight=subprocess%20call#

Re: os.popen command working differently on Windows

2011-05-12 Thread Tim Golden
On 12/05/2011 15:11, Ayaskanta Swain wrote: Please help me in solving the following issue I am facing while executing my python script. Basically I am executing the OS specific move command to move a file/dir from one location to another. Why? Why not use os.rename or shutil.move which already

Re: Need Assistance on this program.

2011-05-12 Thread Tim Golden
On 12/05/2011 11:29, vijay swaminathan wrote: <... snippet from code ...> print 'Invoking Command Promptt..' #subprocess.call(["start", "/DC:\\PerfLocal_PAL", "scripts_to_execute.bat"], shell=True) subprocess.call(["start", "C:\\windows\\system32\\cmd.exe"], shell

Re: Need Assistance on this program.

2011-05-12 Thread Tim Golden
On 12/05/2011 10:45, vijay swaminathan wrote: I tried using that as well. The problem is, the thread becomes dead as soon as it executes the invocation of command prompt. Can you post the code you're using, please? This should be simple so maybe you've misunderstood something in the threading

Re: What other languages use the same data model as Python?

2011-05-09 Thread Tim Golden
On 09/05/2011 15:29, Steven D'Aprano wrote: [... snippage galore ...] Slightly abstract comment: while I don't usually get much enjoyment out of the regular "Python is call-by-value; no it isn't; yes it is" debates, I always enjoy reading Steven D'Aprano's responses. Thanks, Mr D'A. :) TJG --

Re: if statement multiple or

2011-05-06 Thread Tim Golden
On 06/05/2011 14:17, scattered wrote: On May 6, 8:25 am, Christian Heimes wrote: Am 06.05.2011 14:09, schrieb scattered: sets could also work if set('abc')& set(line) == set(): print line Right! Sets work in this special case, because the OP just wants to search for a single char.

Re: Development tools and practices for Pythonistas

2011-05-06 Thread Tim Golden
On 06/05/2011 10:51, Jonathan Hartley wrote: On Apr 26, 3:39 pm, snorble wrote: I appreciate any advice or guidance anyone has to offer. The 'Python Project HOWTO' gives good advice in terms of setting up a new project, what files and directories to create, what to put in version control, etc

Re: minimal python27.dll?

2011-04-27 Thread Tim Golden
On 27/04/2011 11:43, est wrote: I need to ship python runtime environment package on Windows, if I want to stripping unnessasery functions from python27.dll to make it as small as possible(and perhaps finally UPX it), which parts of python27.dll do you think can be removed? Perhaps have a look

Re: Cannot get past this string related issue

2011-04-26 Thread Tim Golden
On 26/04/2011 14:48, Oltmans wrote: Greetings, I hope you're doing well. I'm stuck in a strange issue, most likely due to my own ignorance. I'm reading a config file using ConfigParser module and passing database related info to _mssql. [ ... ] Config file looks like following [DB_INFO] serv

Re: strange use of %s

2011-04-18 Thread Tim Golden
On 18/04/2011 09:29, Tracubik wrote: Hi all, i'm reading a python tutorial in Ubuntu's Full Circle Magazine and i've found this strange use of %s: sql = "SELECT pkid,name,source,servings FROM Recipes WHERE name like '%%%s% %'" %response response is a string. I've newbie in sql. why do the code

Re: split string but ignore sep inside double quotes

2011-04-13 Thread Tim Golden
On 13/04/2011 15:59, Jonno wrote: I have the following unicode object: u'3,"Some, text",more text' and I want to split it into a list like this: [3,"Some, text", more text] In other words I want to split on the comma but not if it's inside a double-quote. You want the csv module which is desi

Re: python2.7.1 freebsd development version

2011-04-01 Thread Tim Golden
On 01/04/2011 16:34, Tim wrote: On Apr 1, 10:55 am, Tim Golden wrote: On 01/04/2011 15:25, Tim wrote: hi, I can't seem to find the development version of python2.7.1; maybe there isn't one any longer, but according to this post, there was a bug in the configure script that affec

Re: python2.7.1 freebsd development version

2011-04-01 Thread Tim Golden
On 01/04/2011 15:25, Tim wrote: hi, I can't seem to find the development version of python2.7.1; maybe there isn't one any longer, but according to this post, there was a bug in the configure script that affects freebsd machines; the patch to fix it was made, but I think I'm not picking that fix

Re: Get USB ID of a serial port through pyserial?

2011-03-31 Thread Tim Golden
On 30/03/2011 20:01, John Nagle wrote: Is there some way to get the USB ID of a serial port through pyserial on Linux and/or Windows? USB serial port devices have device names determined by when they were plugged in. So, if you have more than one USB serial device, you need the USB device's built

Re: delete namespaces

2011-03-30 Thread Tim Golden
On 30/03/2011 8:03 PM, Terry Reedy wrote: On 3/30/2011 5:10 AM, Jean-Michel Pichavant wrote: 3/ if you want to do the 2/ but require a painful long prologue to your test, then you may want to use the builtin reload. Use it with care, because any existing object created from the previous module

<    1   2   3   4   5   6   7   8   9   10   >