[python-win32] Question on .pyw extension in Python
I've installed Python 2.4 on my pc which runs Windows xp. I downloaded scripts from some sites which uses .pyw extension. When I use them the script runs without popping up a console. But when I try to write my own script with pyw extension it doesn't work. Can any one help me? Enjoy this Diwali with Y! India Click here___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] mciSendCommand from win32 ???
Hi ! I want to call mciSendCommand to record a music in Windows. I want to do same thing like in this code (Delphi): procedure TForm1.OpenMedia; var MyOpenParms: TMCI_Open_Parms; begin Flags:=mci_Wait or mci_Open_Element or mci_Open_Type; with MyOpenParms do begin dwCallback:=Handle; // TForm1.Handle lpstrDeviceType:=PChar('WaveAudio'); lpstrElementName:=PChar(''); end; MyError:=mciSendCommand(0, mci_Open, Flags,Cardinal(@MyOpenParms)); if MyError = 0 then FDeviceID:=MyOpenParms.wDeviceID; end; procedure TForm1.RecordMedia; var MyRecordParms: TMCI_Record_Parms; set_parms: MCI_WAVE_SET_PARMS; begin set_parms.wFormatTag := WAVE_FORMAT_PCM; set_parms.wBitsPerSample := 16; set_parms.nChannels := 1; set_parms.nBlockAlign := (set_parms.nChannels*set_parms.wBitsPerSample) div 8; set_parms.nSamplesPerSec := 44100; set_parms.nAvgBytesPerSec := ((set_parms.wBitsPerSample) * set_parms.nChannels * set_parms.nSamplesPerSec) div 8; MyError:=mciSendCommand(FDeviceID,MCI_SET, MCI_WAIT or MCI_WAVE_SET_FORMATTAG or MCI_WAVE_SET_BITSPERSAMPLE or MCI_WAVE_SET_CHANNELS or MCI_WAVE_SET_SAMPLESPERSEC or MCI_WAVE_SET_AVGBYTESPERSEC or MCI_WAVE_SET_BLOCKALIGN, Cardinal(@set_parms)); Flags:=mci_Notify; with MyRecordParms do begin dwCallback:=Handle; // TForm1.Handle dwFrom:=0; dwTo:=1; end; MyError:=mciSendCommand(FDeviceID, mci_Record, Flags, Longint(@MyRecordParms)); end; procedure TForm1.StopMedia; var MyGenParms: TMCI_Generic_Parms; begin if FDeviceID <> 0 then begin Flags:=mci_Wait; MyGenParms.dwCallback:=Handle; // TForm1.Handle MyError:=mciSendCommand(FDeviceID, mci_Stop, Flags,Longint(MyGenParms)); end; end; procedure TForm1.SaveMedia(OrgFileName,FileName:string); type// not implemented by Delphi PMCI_Save_Parms = ^TMCI_Save_Parms; TMCI_Save_Parms = record dwCallback: DWord; lpstrFileName: PAnsiChar; // name of file to save end; var MySaveParms: TMCI_Save_Parms; begin if FDeviceID <> 0 then begin // save the file... Flags:=mci_Save_File or mci_Wait; with MySaveParms do begin dwCallback:=Handle; lpstrFileName:=PChar(FileName); end; MyError:=mciSendCommand(FDeviceID, mci_Save, Flags, Longint(@MySaveParms)); end; end; procedure TForm1.CloseMedia; var MyGenParms: TMCI_Generic_Parms; begin if FDeviceID <> 0 then begin Flags:=0; MyGenParms.dwCallback:=Handle; // TForm1.Handle MyError:=mciSendCommand(FDeviceID, mci_Close, Flags, Longint(MyGenParms)); if MyError = 0 then FDeviceID:=0; end; end; 1. Can I do it ? 2. If not, what is the solution (I haven't Delphi... I have only freeware things) Thanx for help: dd ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Question on .pyw extension in Python
[flame burns] > I've installed Python 2.4 on my pc which runs Windows xp. > I downloaded scripts from some sites which uses .pyw > extension. When I use them the script runs without popping > up a console. But when I try to write my own script with > pyw extension it doesn't work. Can any one help me? Just to clarify: the .pyw extension simply means: run this Python script without creating a console window. This is generally what you want if you have a program which is GUI-based. You can run *exactly* the same program with a console window simply by renaming it to .py. In general, you'll want to name your scripts .py until you've debugged everything, That way, any errors will appear on your console window. If you haven't already, have a look at the FAQ: http://www.python.org/doc/faq/ and in particular the Python Windows FAQ: http://www.python.org/doc/faq/windows.html TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] mciSendCommand from win32 ???
At Monday 28/11/2005 09:55, [EMAIL PROTECTED] wrote: >I want to call mciSendCommand to record a music in Windows. >I want to do same thing like in this code (Delphi): >1. Can I do it ? >2. If not, what is the solution (I haven't Delphi... I have only >freeware things) Try http://www.freepascal.org/ and Lazarus. Or, there is a small DirectSound example, see the PyWin32 help. Gabriel Genellina Softlab SRL ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Error calling win32pdh.EnumObjectItems
Can anyone tell me what this error message means? >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "c:\...\win32pdhutil.py", line 67, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_ DETAIL_WIZARD) pywintypes.api_error: (-2147481646, 'EnumObjectItems for buffer size', 'No error message is available') Thanks. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Error calling win32pdh.EnumObjectItems
It looks like you have an old win32all version (it looks like it was fixed in win32all-154). This should be fixed in all pywin32 versions available from sourceforge. Mark > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Rogelio Flores > Sent: Tuesday, 29 November 2005 10:04 AM > To: python-win32@python.org > Subject: [python-win32] Error calling win32pdh.EnumObjectItems > > > Can anyone tell me what this error message means? > > >>> win32pdhutil.ShowAllProcesses() > Traceback (most recent call last): > File "", line 1, in ? > File "c:\...\win32pdhutil.py", line 67, in ShowAllProcesses > items, instances = win32pdh.EnumObjectItems(None,None,object, > win32pdh.PERF_ > DETAIL_WIZARD) > pywintypes.api_error: (-2147481646, 'EnumObjectItems for buffer > size', 'No error > message is available') > > > Thanks. > ___ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32