[python-win32] how to know the native file path of computer A on computer B
Hi, all I want to run a command remotely, but I have to know the native file path on the remote computer from client computer. Here is the details: -- --- || | | | computer A | |computer B | || | | | C:\shared\database\test.DB | | W:\database\test.DB| || | | | python server| |client | || | | || | | - --- /|\ /|\ | | |-| From computer B, I send a command to computer A. On computer A, python.exe is running 24X7 as a service. When the pyhton server receives the command, it will go into folder C:\shared\database and lunch another program. Now I have to input native path on computer B, and pass the native file path as an argument with the command and send together to computer A. Then the python server knows where to go. I am wondering that is it possible to know the native file path of computer A on computer B ? If possible, is there anyone point me a direction how to do it? This may not be a python question, anyway I asked here, any C/C++/C# programs are ok. Thank you very much. Best regards. Michael Li == This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] wxpython wxGrid
wxWidgets Question regarding grids. There seems to be a display problem. If you scroll horizontally or vertically eventually you get to the end of the row or col. At this point you seem to always be able to scroll a little bit further revealing just some empty space. All the examples in the wxWidgets demo seem to do this too. Is this a bug? Is there a way to avoid it? I saw a reference to wxSheet which seems to be someone's improvement on some shortcomings with wxGrid. Has anyone tried that? Phill ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] how to know the native file path of computer A on computer B
Michael, If you just need to deal with the path to the executable, perhaps os.path.normpath() is what you're looking for. Regards, Tom Michael Li <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 03/21/2006 12:33 PM To python-win32@python.org cc Subject [python-win32] how to know the native file path of computer A on computer B Hi, all I want to run a command remotely, but I have to know the native file path on the remote computer from client computer. Here is the details: -- --- | | | | | computer A | | computer B | | | | | | C:\shared\database\test.DB | | W:\database\test.DB | | | | | | python server | | client | | | | | | | | | - --- /|\ /|\ | | |-| From computer B, I send a command to computer A. On computer A, python.exe is running 24X7 as a service. When the pyhton server receives the command, it will go into folder C:\shared\database and lunch another program. Now I have to input native path on computer B, and pass the native file path as an argument with the command and send together to computer A. Then the python server knows where to go. I am wondering that is it possible to know the native file path of computer A on computer B ? If possible, is there anyone point me a direction how to do it? This may not be a python question, anyway I asked here, any C/C++/C# programs are ok. Thank you very much. Best regards. Michael Li == This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 This e-mail, including attachments, is intended for the person(s) or company named and may contain confidential and/or legally privileged information. Unauthorized disclosure, copying or use of this information may be unlawful and is prohibited. If you are not the intended recipient, please delete this message and notify the sender___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] how to know the native file path of computer A on computer B
Hi, I got bunch of reply, thank you very much. But they are not what i want. Let me make it more clear, my code looks like: nRetCode = os.access(szFolder, os.F_OK) if nRetCode == 1: nRetCode = os.chdir(szFolder) szNormPath = os.path.normpath(szCommand) szBatchFile = szNormPath anArgs = [szBatchFile, 'NDEBUG'] nRetCode = os.spawnv(os.P_NOWAIT, szBatchFile, anArgs) The above code is on the computer A where python server is running. The szFolder must be "C:\shared\database", not "W:\database", because "W:" does not exist on computer A, "W:" is on computer B. Right now, szFolder comes from computer B as an argument inputed on computer B, I want to make szFolder auto-decide if possible. Any ideas ? Best regards. Michael Li Michael Li wrote: > Hi, all > > I want to run a command remotely, but I have to know > the native file path on the remote computer from client > computer. Here is the details: > > -- --- > || | | > | computer A | |computer B | > || | | > | C:\shared\database\test.DB | | W:\database\test.DB| > || | | > | python server| |client | > || | | > || | | > - --- >/|\ /|\ > | | > |-| > > From computer B, I send a command to computer A. > On computer A, python.exe is running 24X7 as a service. > When the pyhton server receives the command, it will go into > folder C:\shared\database and lunch another program. > Now I have to input native path on computer B, and pass > the native file path as an argument with the command and send together > to computer A. Then the python server knows where to go. > I am wondering that is it possible to know the native file path of > computer A on computer B ? > If possible, is there anyone point me a direction how to do it? > This may not be a python question, anyway I asked here, any C/C++/C# > programs are ok. > Thank you very much. > > Best regards. > Michael Li > > == > This email message and any attachments are for the sole use of the intended > recipients and may contain proprietary and/or confidential information which > may be privileged or otherwise protected from disclosure. Any unauthorized > review, use, disclosure or distribution is prohibited. If you are not the > intended recipients, please contact the sender by reply email and destroy the > original message and any copies of the message as well as any attachments to > the original message. > > ___ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 == This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] how to know the native file path of computer A on computer B
I forgot to mention that: W: on computer B is a mapped network drive, which is C:\shared on computer A. So W:\database\test.DB on computer B and C:\shared\database\test.DB on computer A are pointed to the same file. From computer B, I only know the file path is W:\database, when the program actually runs on computer A, I need to know the real file path C:\shared\database on computer A. The folder itself is not the fixed, it might be D:\aaa, also the mapped drive path is not fixed, it might be X:\bbb. Michael Li wrote: > Hi, > I got bunch of reply, thank you very much. > But they are not what i want. > Let me make it more clear, my code looks like: > > nRetCode = os.access(szFolder, os.F_OK) > if nRetCode == 1: > nRetCode = os.chdir(szFolder) > szNormPath = os.path.normpath(szCommand) > szBatchFile = szNormPath > anArgs = [szBatchFile, 'NDEBUG'] > nRetCode = os.spawnv(os.P_NOWAIT, szBatchFile, anArgs) > > The above code is on the computer A where python server > is running. The szFolder must be "C:\shared\database", not > "W:\database", because "W:" does not exist on computer A, > "W:" is on computer B. > > Right now, szFolder comes from computer B as an argument inputed > on computer B, I want to make szFolder auto-decide if possible. > Any ideas ? > > Best regards. > Michael Li > > > Michael Li wrote: > >> Hi, all >> >> I want to run a command remotely, but I have to know >> the native file path on the remote computer from client >> computer. Here is the details: >> >> -- --- >> || | | >> | computer A | |computer B | >> || | | >> | C:\shared\database\test.DB | | W:\database\test.DB| >> || | | >> | python server| |client | >> || | | >> || | | >> - --- >>/|\ /|\ >> | | >> |-| >> >> From computer B, I send a command to computer A. >> On computer A, python.exe is running 24X7 as a service. >> When the pyhton server receives the command, it will go into >> folder C:\shared\database and lunch another program. >> Now I have to input native path on computer B, and pass >> the native file path as an argument with the command and send together >> to computer A. Then the python server knows where to go. >> I am wondering that is it possible to know the native file path of >> computer A on computer B ? >> If possible, is there anyone point me a direction how to do it? >> This may not be a python question, anyway I asked here, any C/C++/C# >> programs are ok. >> Thank you very much. >> >> Best regards. >> Michael Li >> >> == >> This email message and any attachments are for the sole use of the >> intended recipients and may contain proprietary and/or confidential >> information which may be privileged or otherwise protected from >> disclosure. Any unauthorized review, use, disclosure or distribution >> is prohibited. If you are not the intended recipients, please contact >> the sender by reply email and destroy the original message and any >> copies of the message as well as any attachments to the original message. >> >> ___ >> Python-win32 mailing list >> Python-win32@python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > > == This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Re: how to know the native file path of computer A
Michael Li wrote: > Hi, > I got bunch of reply, thank you very much. > But they are not what i want. > Let me make it more clear, my code looks like: > > nRetCode = os.access(szFolder, os.F_OK) > if nRetCode == 1: > nRetCode = os.chdir(szFolder) > szNormPath = os.path.normpath(szCommand) > szBatchFile = szNormPath > anArgs = [szBatchFile, 'NDEBUG'] > nRetCode = os.spawnv(os.P_NOWAIT, szBatchFile, anArgs) > > The above code is on the computer A where python server > is running. The szFolder must be "C:\shared\database", not > "W:\database", because "W:" does not exist on computer A, > "W:" is on computer B. > > Right now, szFolder comes from computer B as an argument inputed > on computer B, I want to make szFolder auto-decide if possible. > Any ideas ? > You can use win32net.NetUseGetInfo to find what network share your local drive is mapped to, and then win32net.NetShareGetInfo to get the local path on the remote machine. Roger ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Re: win32process open-terminate loop cripples OS
David S wrote: > Hello, > > I decided to attempt to use python's win32 extensions as a method to > monitor and control process for my python application. It's working > well in the short term, but, as this app is intended to be very > low-maintenance, and probably high-uptimes without restarting, I want to > put it to the test. I set a loop similar to below to run every second > for the weekend. It wasn't very pretty. I didn't get any process > information (couldn't - system was /almost/ unresponsive) - the most i > could do was alt-tab around, though it wouldn't paint the window, move > the mouse pointer and turn the num lock light on and off. Can anyone > provide some guidance or perhaps point out a problem in my code? > > For what it's worth, I think I can poll process /ad infinitum/ without > any lockups. > > Thank you, > > -David S. > It's hard to diagnose without seeing all the code, but it sounds like you might be running out of memory. Are you printing a lot of output that could be bloating the screen buffer ? Also, you might want to check that all the handles you open are closed properly. The ones created as PyHANDLEs will be closed automatically, but plain int handles won't be. hth Roger ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Starting a GUI app from AddIn server
Hi, I'm facing the following problem: I have written an AddIn server which is called from a GUI application. After some action in the GUI app the function DoSomething of class CmdEvtHandlerStartApp is called. This works pretty fine. class AddInBase: """ Base class for CADdy++ AddIns. """ _com_interfaces_ = ['ICADdyAddIn'] _public_methods_ = [] _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER _reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy" _typelib_guid_= '{9C3BB401-114D-11D4-AC72-00105A4925FC}' class AddIn(AddInBase): _reg_clsid_ = '{FC76E6CC-B0C8-4233-AFFA-45594501A4F0}' _reg_progid_ = 'CADdyAddIn.PythonGui0' def __init__(self): AddInBase.__init__(self) def OnInit(self, theCADdy): NewCmd = self.AddCmd(NewPool, "StartGuiApplication", constants.CMD_NOBREAK, CmdEvtHandlerStartApp) class CmdEvtHandlerStartApp(CmdEvtHandlerBase): def OnExecute(self, cmd, data, cmdStr): self.DoSomething() def DoSomething(self): Now, I would like to start a separate wxPython GUI app/dialog (wxAppGui0) from the DoSomething call which should run asynchronously to the main GUI app. The following requirements should be met: 1. The app/dialog should always stay on top of the main GUI app 2. The app/dialog should not appear on the window taskbar 3. The main GUI should not be affected by the app/dialog 4. I need some communication between the AddIn class and the app/dialog I tried the following with varying success: a) Idee: Use a separate thread for the app/dialog and use proper locking for data exchange between the threads. def DoSomething(self): import threading import wxAppGui0 thread = threading.Thread(target = wxAppGui0.main) thread.start() => This seems to work fine for a first call to the DoSomething function. But after closing the wxAppGui0 app/dialog it is impossible to restart the app/dialog by a new call to function DoSomething. Inside wxPython the call to the embedded function CreateWindowEx failed: File "C:\Programme\Python\Lib\site-packages\wx-2.6-msw-ansi\wx\_controls.py", line 79, in __init__ newobj = _controls_.new_Button(*args, **kwargs) PyAssertionError: C++ assertion "wxAssertFailure" failed in ..\..\src\msw\control.cpp(162): CreateWindowEx("BUTTON", flags=5601, ex=) failed This problem only appears if I have set the wxFrame style to wx.FRAME_NO_TASKBAR. Is there anything I could do in order to use this case? Is this the recommended way to go? Are there any additionl flaws with this design? b) Idee: Create a completly separate process for the app/dialog and setup some communication infrastructure. def DoSomething(self): cmd = r'C:\Development\Learn\Python\COM\Test\Lesson3\wxAppGui0.pyw' import win32process procHandle, threadHandle, procId, threadId = win32process.CreateProcess( None, # appName 'pythonw.exe ' + cmd, None, # process security None, # thread security 0, # inherit handles win32process.NORMAL_PRIORITY_CLASS, None, # new environment None, # Current directory win32process.STARTUPINFO(), # startup info ) => For this scenario I have to build additional communication infrastructure (COM or pipes). I would like to avoid additional registering of a wxAppGui0 COM server. Another problem is that I do have to explicitly specify the wxAppGui0.pyw path. For a) and b), additionally, I don't know how to force the app/dialog always to be on top of the GUI app. How can I enforce this requirement? Can I somehow tell wxPython to use my GUI application as it's parent? Could someone recommend a design for the above use case? I don't have much experiences in the field. Best Johannes Virus checked by G DATA AntiVirusKit Version: AVK 16.5392 from 08.02.2006 Virus news: www.antiviruslab.com ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32