Hi all,
I'm working on an application that will be used by several users at the same
time. The user should be able to both read and write to some data file
stored on our file server. My question is: how can I prevent that one user
writes to the file while another user is reading it?
I've seen
Thank you, Tim.
The portalocker code seems to prevent reading while the file is locked for
writing, but it doesn't seem to prevent multiple writes (nor multiple
exclusive locks, for that matter).
I guess it'd be better if I use the second suggestion, i.e. temporarily
renaming the file for
Correction: it's probably best to use the Flock class by John Nielsen. Much
cleaner and working great. Info can be found here:
http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/Windows_NT_Files_.2d.2d_Locking.html
Best regards,
g
Guy Lateur [EMAIL PROTECTED] schreef in bericht
Hi all,
Suppose you have this class:
class foo:
def bar():
Suppose you also have the strings foo and bar. How can you obtain the
function foo.bar()?
Surely somebody knows..
TIA,
g
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the feedback, people.
I actually only need the bar part (instance methods). I added the foo
part to generalize the question without really thinking it through first.
Still, it has gotten me more information than I ever imagined. So thanks
again.
g
--
] schreef in bericht
news:[EMAIL PROTECTED]
Guy Lateur schrieb:
Hi all,
I've been writing an application containing a lot of settings which can
be
changed by the user. I'm using wx.Config to read/write these settings (to
the windows registry). This means I can only store strings, ints and
floats
Hi all,
I've been writing an application containing a lot of settings which can be
changed by the user. I'm using wx.Config to read/write these settings (to
the windows registry). This means I can only store strings, ints and floats.
However, it would be very convenient if I could also store
Yes! I finally got it to work. I've written a VBscript which I'll call from
python. It uses Outlook.Redemption's SafeMailItem. No need to use IMAP or
whatever services.
Only weird thing is it doesn't put the msg in the Inbox, as I intended, but
in the Drafts folder. Well, never mind that, it's
python version:
import win32com.client
myOL = win32com.client.Dispatch(Outlook.Application)
myNS = myOL.GetNamespace(MAPI)
sItem = win32com.client.Dispatch(Redemption.SafeMailItem)
myDestBox = myNS.GetDefaultFolder(6)
oItem = myDestBox.Items.Add(0)
sItem.Item = oItem
Ok, we didn't have the IMAP service running; we do now (no SSL).
Connecting to the server is not a problem anymore, but logging in is. It
works with the administrator account, but not with my personal account. We
have restricted access to all machines in 10.0.0.0/255.255.255.0, which
includes
Thanks for the suggestion, Tim. Unfortunately, I get a 'connection refused'
error on the line 'M = imaplib.IMAP4(server)'. It says socket.error:
(10061, 'Connection refused'). I've tried both the external IP adress and
the internal one (10.0.0.2). I'm sure there's a way to get over this, isn't
Are you saying it's unsafe to do that? I only need this for an application
running locally, I mean, from within our LAN domain. We do have Exchange
webmail.
I've asked our Exchange expert wether or not IMAP is running; awaiting an
answer..
Richard Brodie [EMAIL PROTECTED] schreef in bericht
I just tried this and it failed with IP addresses but not
hostnames/machine names, try it again with the server name. :)
Nope, same problem. I think TJG might be right, and our server probably
doesn't have IMAP running (yet).
Depends how secure you need it to be.For my simple stuff I
Tim Williams (gmail) [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
Could you SMTP it back in ? It would gain an extra Received: header
but the rest of the email would most likely be unaltered.
I don't understand what you mean. How does this have to do with connecting
to the
guy lateur [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
|
| Tim Williams (gmail) [EMAIL PROTECTED] schreef in bericht
| news:[EMAIL PROTECTED]
| Could you SMTP it back in ? It would gain an extra Received: header
| but the rest of the email would most likely be unaltered
Hi all,
I've been writing some code to move some data into and out of Outlook (2003
+ Exchange 2003). I have some email .msg files on our file server, and I
can't seem to get them back into the Outlook object I need, ie a MailItem.
I've tried to use App.CopyFile() to (temporarily) put the file
Thanks for the tip, Simon, but unfortunately it doesn't work; it says The
interface name 'MailItem' does not appear in the same library as object
'win32com.gen_py.Microsoft Outlook 11.0 Object Library._DocumentItem
instance at 0x29912600
Anything else I could try?
Cheers,
g
Simon Brunning
Just an update: I've succeeded in writing a COM server, exposing wxPy
funtcionality. I've also used this object from within Outlook - 2 lines of
VBA: dispatch COM object call method. If anyone is interested, I could
post the source.
A few days ago, I honestly didn't think I'd already be this
Hi all,
I am trying to write some code (macro's, if you like) to glue together
our Office applications (mainly Word, Excel and Outlook). We have a lot
of different projects going on simultaneously. The idea is to develop a
centralized framework (starting point, common interface) for my users
to
You want to use --- Python ???
So far I haven't been informed of any serious arguments as to why I
wouldn't.
How, pray tell, do you add up (VBA+VBA+VBA+VBA+VBA) and have it come out
equaling Python?
My total was this: 57*python + wxPython.
Do you think that might please a few of us
Hi all,
This goes back to my previous post called Where is Word. In short, I
wanted to make a temporary file (directory listing), open it in Word to let
the user edit, layout and print it, and then delete the temp file
afterwards.
I almost got it to work without using COM, but there was a
Hi all,
I'm trying to generate a (exhaustive) list of all the applications that are
installed on a user's machine. I've written some code that reads the
registry ('App Paths'):
code
appKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App
| What -- from your point of view -- is an application?
Good question. Let me try to elaborate: I would like to know if people in
our company (building techniques) are using non-licensed software (eg
Photoshop, Office, AutoCad). So I guess by 'application' I mean commercial
software packages
| [TJG]
| Hmmm. While I understand your requirement, it's not as
| thought there's some easily-discernible charactersistics
| of commercial software packages which should have licenses
| but which don't
No? Really? How disappointing.. ;)
| [TJG]
| By the sound of it, you're almost better off
Ok, I've tried various proposed solutions, and this is what I've come up
with:
code
# get Word path
wordKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
wPath = win32api.RegQueryValue(wordKey, 'winword.exe')
Hi all,
I need a way to get the path where MS Word/Office has been installed. I need
to start Word from a script (see earlier post), but it doesn't work if I
don't know its path. So os.system(winword.exe %s % fileName) doesn't
always work; I need to say os.system(C:\Program Files\Microsoft
Unfortunately, I need to open/edit a (temporary) text file with Word, and
those are opened by default with UltraEdit (or Notepad or..). Thanks for the
tip, though.
Anything else? Do I need to read the registry?
g
While this doesn't answer the question you're asking, I
believe it does solve
Thanks, but could you pretty please post some code that does this? I'm new
to Python, let alone COM..
TIA,
g
Tomasz Lisowski [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
You may try to launch Word as a COM object and control it directly from
Python using the COM object
Thank you very much; I'll check that out shortly.
g
Tim Golden [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
OK, a slightly more intelligent idea in place of my previous
one. You can use win32api.ShellExecute (from the pywin32 extensions)
which is like a beefed-up os.startfile.
we'll be able to fully automate it, though. The
user should be able to set her own fonts and stuff.
g
Peter Hansen [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
Guy Lateur wrote:
I need a way to get the path where MS Word/Office has been installed. I
need to start Word from
No, the subject is a good way to refer to past posts. I just meant
forcing us to dig back, when the post may no longer even be on our
servers, is not helpful.
I agree, my bad.
(Perhaps I should ask why anyone would want to waste time putting
arbitrary fonts and colours and such around
Thanks for all the feedback, everyone. What a helpfull community this is!
It's actually kinda hard keeping up with y'all..
Cheers,
g
Guy Lateur [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
Hi all,
I need a way to get the path where MS Word/Office has been installed. I
need
This may be getting somewhat OT, but I'd like to dig a little deeper into
this.
First of all, security (as in some other proces reading/disclosing the data)
is not an issue in this case. The thing is, though, a user could run the
script twice, not having closed Word after the first time. So I
about
it?
Alternatively, I could send the info about a user's print jobs from their
individual pc to a central 'database', and then get it from there.
Just brainstorming out loud, here..
Guy Lateur [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
Hmm, this only seems to work for jobs
, Guy Lateur [EMAIL PROTECTED] wrote:
We have several printers in our company network. I would like to know if
it
is possible to check the current print jobs/queues for each of them. That
way, if a user wants to print something (big), I could give her a hint as
to
which printer would get
Hi all,
I was wondering if it would be possible to launch an application, block
until the app exits, and do some cleanup afterwards.
Maybe an example will be clearer: I would like to make a temperary (text)
file, open it with MS Word for the user to edit/layout/print, and then
delete the temp
Also note that this method of creating tempfiles is technically unsafe,
as it is theoretically possible that another process would create a file
of the same name in the same directory and then try to use it, resulting
in a race condition between the two processes. This is practically
unlikely,
Hi all,
We have several printers in our company network. I would like to know if it
is possible to check the current print jobs/queues for each of them. That
way, if a user wants to print something (big), I could give her a hint as to
which printer would get the job done first. We're using win2k
38 matches
Mail list logo