a chance from you.

2011-02-28 Thread marian
You'll like the way I was convinced a girl for winning the new Volvo
S60:
http://www.unlimitednaughty.ro/camera/video/concurent/Marian-Briceag
Give me a chance by sharing this video to everyone on the group.
Please, please SHARE it :) . p.s.: for English turn on the captions
(the cc, under arrow from the right-bottom side of video). This is not
a spam, it's my dream. Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Please i need a hand with writing a simple task.

2005-12-19 Thread Marian
  Can you pleae help me with this task. I have really hard time with my textbook desolving this problem.   The Task:  Write a program that will create a text file, print the contents of the text file as you create the file. Read the contents of the file after it's been created, add a record and print the contents of the file, remove a record(s) from the specified file, write it again, read it again, print the contens of the new file.     those are the file specifications include:  CIT101  Academic Computer Skills   CIT111 =  Database Management   CIT115 =  Intro to Computer scince CIT127 =  ACCESS   CIT211 =  Systems Analysis and Design   CIT216 = Visual BasicCIT218 = Intermediate Visual BasicCIT234 = Decision Support Using Excel     cours!
 es to
 add:  CIT236 SQL Programming  CIT240 Database Programming     Courses to delete:  CIT111  CIT211  CIT218         Thanks a lot in advance !!      Mario !!!__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 
http://mail.python.org/mailman/listinfo/python-list

this where I am so far !

2005-12-19 Thread Marian
Any one who  have a clue how can I add and  remove records from a list. if the record is dictionary type)   This the program I am working on. I have no idea how can I remove and  add some more courses !   import cPickle, shelve  def  write_file():           CIT101 = ["Academic Computer Skills"]      CIT111 = ["Database Management"]      CIT115 = ["Intro to Computer scince"]      CIT127 = ["ACCESS"]      CIT211 = ["Systems Analysis and Design"]      CIT216 = ["Visual Basic"]      CIT218 = ["Intermediate Visual Basic"]      CIT234 = ["Decision Support Using
 Excel"]      pickle_file = open("pickles1.dat","w")    cPickle.dump(CIT101, pickle_file)      cPickle.dump(CIT111, pickle_file)      cPickle.dump(CIT115, pickle_file)      cPickle.dump(CIT127, pickle_file)      cPickle.dump(CIT211, pickle_file)      cPickle.dump(CIT216, pickle_file)      cPickle.dump(CIT218, pickle_file)      cPickle.dump(CIT234, pickle_file)      print "A file has been created and the required specifications have been added"      pickle_file.closedef read_file():      pickle_file = open("pickles1.dat","r")      CIT101 = cPickle.load(pickle_file)      CIT111 = cPickle.load(pickle_file)      CIT115 = cPickle.load(pickle_file)    &nbs!
 p; CIT127
 = cPickle.load(pickle_file)      CIT211 = cPickle.load(pickle_file)      CIT216 = cPickle.load(pickle_file)      CIT218 = cPickle.load(pickle_file)      CIT234 = cPickle.load(pickle_file)      pickle_file.close()      pickles = shelve.open("pickles2.dat")      pickles["CIT101"] = ["Academic Computer Skills"]      pickles["CIT111"] = ["Database Management"]      pickles["CIT115"] = ["Intro to Computer scince"]      pickles["CIT127"] = ["ACCESS"]      pickles["CIT211"] = ["Systems Analysis and Design"]      pickles["CIT216"] = ["Visual Basic"]      pickles["CIT218"] = ["Intermediate Visual Basic"]      pickles["CIT234"] = ["Decision Support Using Excel"]    pickles.sync() !
   
     for key in pickles.keys():      print key, "-", pickles[key]def dele_file():      word_dele = raw_input("Which record do u want to delete?: ")    if word_dele in picles.keys():      del word_dele    else:      print "There is no such record in file pickles2.dat"            pickles.close()  def display_instructions():      """Display the Main menue"""      print \    """      Main Manue:        1. Exit  &nb!
 sp; 2.
 Create a new file and add specifications    3. (not working)Add more courses to the file    4. Read the file    5. (not working)Delete file  """        # exit the  program    >>> 1 <<<  def over_program():      """Exit the program"""      print "Good Bye!"      def main():      choice = None      display_instructions()                  while choice != 1: 
     choice = raw_input("\nChoice: ")      if choice == "1":      over_program()      break            elif choice == "2":      write_file()    elif choice == "3":      add_to_file()                  elif choice == "4":      read_file()    elif choice == !
 "5": 
     delete_file()            else:      print "\nSorry, but", choice, "isn't a valid choice."main()  raw_input("Press Enter Key to Exit.")    __Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 
http://mail.python.org/mailman/listinfo/python-list

Stuck with urllib.quote and Unicode/UTF-8

2011-05-07 Thread Marian Steinbach
Hi!

I am stuck with calling URLs with parameters containing non-ASCII
characters. I'm creating a url like this.

  url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' +
urllib.quote(address) + '&sensor=false&language=DE'

address can be a string like u"Köln, Nordrhein-Westfalen". This results in

  
http://maps.googleapis.com/maps/api/geocode/json?address=K%F6ln%2C%20Nordrhein-Westfalen&sensor=false&language=DE

and this doesn't seem to meet Google's Encoding expectations. I get an
"INVALID REQUEST" response. (The same things works if there are only
ASCII characters in the address.)

When I manually enter the "Köln"... string in the Firefox address bar,
Firefox makes the URL

  
http://maps.googleapis.com/maps/api/geocode/xml?address=K%C3%B6ln,%20Nordrhein-Westfalen&sensor=false&language=DE

out of this and it works fine. %C3%B6 seems to be the url-encoded
representation of an UTF-8 representation of a "ö" character.


So the next thing I tried is to get address utf-8-encoded, like this:

  url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' +
urllib.quote(address.encode('utf-8')) + '&sensor=false&language=DE'

This gives me an error like

  UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position
1: ordinal not in range(128)

Again, the input string for address is u"Köln, Nordrhein-Westfalen".


Can you see what I'm doing wrong or what I would have to to to get
from u"ö" to "%C3%B6"?


Thanks!

Marian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stuck with urllib.quote and Unicode/UTF-8

2011-05-07 Thread Marian Steinbach
An addition/correction:

It seems as if my input variable address is not Unicode. This is what
I get for print [address]:

['K\xf6ln, Nordrhein-Westfalen']

Isn't this utf-8 encoding?

And I'm using Python 2.5.2.
-- 
http://mail.python.org/mailman/listinfo/python-list


Printing Filenames with non-Ascii-Characters

2005-02-01 Thread Marian Aldenhövel
Hi,
I am very new to Python and have run into the following problem. If I do
something like
  dir = os.listdir(somepath)
  for d in dir:
 print d

The program fails for filenames that contain non-ascii characters.
  'ascii' codec can't encode characters in position 33-34:
I have noticed that this seems to be a very common problem. I have read a lot
of postings regarding it but not really found a solution. Is there a simple
one?
What I specifically do not understand is why Python wants to interpret the
string as ASCII at all. Where is this setting hidden?
I am running Python 2.3.4 on Windows XP and I want to run the program on
Debian sarge later.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread Marian Aldenhövel
Hi,
Thank you very much, you have collectively cleared up some of the confusion.
English windows command prompt uses cp437 charset.
To be exact my Windows is german but I am not outputting to the command 
prompt
window. I am using eclipse with the pydev plugin as development platform and
the output is redirected to the console view in the IDE. I am not sure how
this affects the problem and have since tried a vanilla console too. The
problem stays the same, though.
I wonder what surprises are waiting for me when I first move this to my
linux-box :-). I believe it uses UTF-8 throughout.
> print d.encode('cp437')
So I would have to specify the encoding on every call to print? I am sure to
forget and I don't like the program dying, in my case garbled output would be
much more acceptable.
Is there some global way of forcing an encoding instead of the default
'ascii'? I have found references to setencoding() but this seems to have gone
away.
The issue is a terminal only understand certain character set.
I have experimented a bit now and I can make it work using encode(). The
eclipse console uses a different encoding than my windows command prompt, by
the way. I am sure this can be configured somewhere but I do not really care
at the moment.
> If you have  unicode string, like d in your case, you have to encode it before
it can be printed.
I got that now.
So encode() is a method of a unicode string, right?. I come from a background
of statically typed languages so I am a bit queasy when I am not allowed to
explicitly specify type.
How can I, maybe by print()-ing something, find out what type d actually is
of? Just to make sure and get a better feeling for the system?
Should d at any time not be a unicode string but some other flavour of string,
will encode() still work? Or do I need to write a function myPrint() that
distinguishes them by type and calls encode() only for unicode strings?
So how did you get a unicoded d to start with?
I have asked myself this question before after reading the docs for
os.listdir(). But I have no way of finding out what type d really is (see
question above :-)). So I was dead-reckoning.
Can I force a string to be of a certain type? Like
nonunicode=unicode.encode("specialencoding")
How would I do it the other way round? From encoded representation to full
unicode?
If 'somepath' is unicode,  os.listdir returns a list of unicode. 
> So why is somepath unicode?
> One possible source is XML parser, which returns string in unicode.
I get a root-directory from XML and I walk the filesystem from there. That
explains it.
Windows NT support unicode filename. I'm not sure about Linux. The 
result maybe slightly differ.
I think I will worry about that later. I can create files using german 
umlauts
on the linux box. I am sure I will find a way to move those names into my
Python program.
I will not move data between the systems so there will not be much of
a problem.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread Marian Aldenhövel
Hi,
Don't be tempted to ever change sys.defaultencoding in site.py, this is 
site specific, meaning that if you ever distribute them, programs 
relying on this setting may fail on other people's Python installations.
But wouldn't that be correct in my case?
> If you're printing to the console, modern Pythons will try to guess the
> console's encoding (e.g. cp850).
But it seems to have quessed wrong. I don't blame it, I would not know of
any way to reliably figure out this setting.
My console can print the filenames in question fine, I can verify that by
simple listing the directory, so it can display more than plain ascii.
The error message seems to indicate that ascii is used as target.
So if I were to fix this in sity.py to configure whatever encoding is
actually used on my system, I could print() my filenames without explicitly
calling encode()?
If the program then fails on other people's installations that would mean
one of two things:
1) They have not configured their encoding correctly.
2) The data to be printed cannot be encoded. This is unlikely as it comes
   from a local filename.
So wouldn't fixing site.py be the right thing to do? To enable Python to print
everything that can actually be printed and not barf at things it could print
but cannot because it defaults to plain ascii?
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread Marian Aldenhövel
Hi,
Have you set the coding cookie in your file?
Yes. I set it to Utf-8 as that's what I use for all my development.
Try adding this as the first or second line.
# -*- coding: cp850 -*-
Python will then know how your file is encoded
That is relevant to the encoding of source-files, right? How does it affect
printing to standard out?
If it would I would expect UTF-8 data on my console. That would be fine, it
can encode everything and as I have written in another posting in my case
garbled data is better than termination of my program.
But it uses 'ascii', at least if I can believe the error message it gave.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Printing Filenames with non-Ascii-Characters

2005-02-03 Thread Marian Aldenhövel
Hi,
> Python's drive towards uncompromising explicitness pays off
big time when you're dealing with multilingual data.
Except for the very implicit choice of 'ascii' as an encoding when
it cannot make a good guess of course :-).
All in all I agree, however.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"There is a procedure to follow in these cases, and if followed it can
 pretty well guarantee a generous measure of success, success here
 defined as survival with major extremities remaining attached."
--
http://mail.python.org/mailman/listinfo/python-list


pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
I am trying to make pygame play music on windows. This simple program:
import pygame,time
pygame.init()
print "Mixer settings", pygame.mixer.get_init()
print "Mixer channels", pygame.mixer.get_num_channels()
pygame.mixer.music.set_volume(1.0)
pygame.mixer.music.load('file1.mp3)
print "Play"
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
print "Playing", pygame.mixer.music.get_pos()
time.sleep(1)

print "Done"
seems to work. It runs the loop and prints values that look like ms into the
file. After a reasonable time corresponding to the length of "file1.mp3" the
loop is exited and the program ends.
The same thing happens for .mp3 files, .ogg files and .wav files.
Fine. The only problem is that there is no sound :-).
What am I doing wrong? pyGame example games do play sound, but I have not
found an example that uses music.
My ultimate goal is to build a MP3 jukebox that runs on Windows and Linux. I
have chosen pyGame as I am making a graphical Frontend using OpenGL. I have
also tried to look at pymad (which I could not get to work on Windows, no
C-Compiler on this machine and I could not find binaries) and audiere (no
skipping, at least in the python binding. A feature I would like to have.)
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
Search the net. You are not the first to try and build a jukebox out of pygame ;)
I did find a few, yes.
Currently this is a toy project as I am learning the language, so early
success means more to me than perfect results. And, as I said, I do not really
have an alternative.
Maybe some way to remote control another player would be in order. Leave it
to software that is specialized and all. But I would want something that runs
on Windows and Linux which narrows down my options.
You have a typo in the code you posted that may be your problem.
You are refering to the missing ' in the filename?
  pygame.mixer.music.load('file1.mp3)
No, that's not the problem. I did paste working code but I then edited out the
full absolute path that I had coded into the program and introduced the error.
I also tried your sample but no difference. Must be something on my system
as it does seem to play...
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
Please post your os name and version, Python version, Pygame version,
German Windows XP Home, 2.3.4, 1.6
Also you can try and look for another sound package
I will. Until I find something suitable I will just build a dummy class
that has the commands I need, I can later interface that to whatever I
really use. Should I ever get to that point - as I said, this is a toy
project and they tend to die suddenly :-).
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
> Could it be a hardware problem?
I don't think so. I can play sounds on this machine and I can also play
this very file using Windows Media Player. I suspect it's software, but
I do not know at which level the problem may lie.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
Perhaps Zinf?
I could not find anything about remote-controlling it. Did not install
it, however.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
Also you can try and look for another sound package, like maybe pyFMOD
I have looked at it. While I do not like some of the boasting on the FMOD
site it does seem very suitable.
FMOD is cross-platform but pyFMOD is available only as Win32-Setup. Does
that mean it cannot be made to work on Linux or is it just not packaged
for it? It looks like your standard DLL-Import-File as known from other
languages and uses ctypes (had to install that first). How hard can it be
to make a version that loads a shared library with the same API on Linux?
To make pyFMOD work with the current version of FMOD I had to fix it in a
few obvious places. After doing so the new version of my micro-program
looks like this:
import time
from pyFMOD import *
res = FSOUND_Init(44100, 32, 0)
print "FSOUND_Init() =", res
stream = FSOUND_Stream_Open("file1.mp3",0,0,0)
print "FSOUND_Stream_Open() =", stream
res = FSOUND_Stream_Play(FSOUND_FREE,stream)
print "FSOUND_Stream_Play() =", res
while True:
print "FSOUND_Stream_GetTime() =", FSOUND_Stream_GetTime(stream)
time.sleep(1)
And plays fine. Now I need to read up on FMODs API to find out how to
eliminate the "while True;" but that should not be a problem. This would give
me a very rich API with full control.
I am having fun! Thank you all.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi,
Just curious what is not suitable about FMOD?
Nothing. See my other posting. It just took me some time...
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unable to run IDLE Under Windows

2005-02-06 Thread Marian Aldenhövel
Hi,
> Any ideas as to what might me wrong?
TclError: unknown color name "white "
There is a space after "white" in this error-message. If this string comes
from some per-user configuration that may well explain your problem.
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


pyFMOD writing a callback function in Python

2005-02-10 Thread Marian Aldenhövel
Hi,
I am using the FMOD audio-library with the pyFMOD python bindings. pyFMOD uses
ctypes. It is possible to register callback functions with FMOD that are
called at certain points in the processing pipeline or when certain events
happen.
I am expecially interested in the one that fires when a currently playing
stream ends. This is what the declaration in pyFMOD looks like:
  _FSOUND_Stream_SetEndCallback =
 getattr(fmod,"[EMAIL PROTECTED]")
  _FSOUND_Stream_SetEndCallback.restype = c_byte
  def FSOUND_Stream_SetEndCallback(stream, callback, userdata):
 result = _FSOUND_Stream_SetEndCallback(c_int(stream), c_int(callback),
c_int(userdata))
 if not result: raise fmod_exception()
I cannot make it work, however. I tried:
  def _sound_end_callback(stream,buf,len,userdata):
print "_sound_end_callback(): Stream has reached the end."
as simplest possible callback function. I am registering it like this:
  pyFMOD.FSOUND_Stream_SetEndCallback(_currenttrack,_sound_end_callback,0)

And this is how my program dies:
  File "d:\projekte\eclipse\workspace\gettone\gettonesound.py", line 175, in 
sound_tick
pyFMOD.FSOUND_Stream_SetEndCallback(_currenttrack,_sound_end_callback,0)
  File "c:\programme\Python23\lib\site-packages\pyFMOD.py", line 690, in 
FSOUND_Stream_SetEndCallback
result = _FSOUND_Stream_SetEndCallback(c_int(stream), c_int(callback), 
c_int(userdata))
TypeError: int expected instead of function instance

I am very new to Python and have zero idea what the problem is nor how to
solve it. In some of my other languages I would have to explicitly make a
function pointer and possibly have to cast that to an int to pass it to
SetEndCallback, but that seems very inappropriate in Python...
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pyFMOD writing a callback function in Python

2005-02-11 Thread Marian Aldenhövel
Hi,
I was only able to find fmodapi374.zip (for windows), and that version doesn't 
> seem to work with the pyFMOD release I found.
I found that too. But I could easily fix pyFMOD to use the FMOD 374. A few of
the exports have been renamed and parameters have been added to others. As the
total size of all parameters are encoded in the exported names all of these
errors are caught when importing so you can fix them one by one by looking it
up in the FMOD-Docs.
All in all, it should look similar (I can't test it!) to this code:
I will try that when I get around to playing with the stuff again.
You should also be aware that you have to keep the callback_function
object alive *as long as the FMOD library is using it*!
While very obvious I am prone to forget that sometime :-).
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Re: pyFMOD writing a callback function in Python

2005-02-16 Thread Marian Aldenhövel
Hi,
Check out pySonic, a new FMOD wrapper written with Pyrex. Much more Pythonic.
I have only found Win32-Downloads. The same is true for pyFMOD. What options
do I have to make it work on Linux?
Ciao, MM
--
Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013.
http://www.marian-aldenhoevel.de
"Wir brauchen keine Opposition, wir sind bereits Demokraten."
--
http://mail.python.org/mailman/listinfo/python-list


Launch an application and continue the script's execution

2008-08-22 Thread Marian Popa
Hello,
I am new in Python programming and I have the following problem:
I have a script in which I need to open an application (called from a batch 
file - "trace.bat"). For this purpuse, I'm executing the following piece of 
code:
 
import os, win32process
from win32api import Sleep
from ctypes import windll, c_double
amt = windll.LoadLibrary("D:\\Marian\\Proiecte\\AMT\\Libs\\AMT_Temp_DLL.dll")
amt.InitUIForDLL()
amt.SetKL30()
Sleep(1000)
amt.SetKL15()
Sleep(1000)

os.chdir("D:\\Marian\\Proiecte\\AMT\\Trace")
os.startfile("launch_trace.bat")
#subprocess.call("D:\\Marian\\Proiecte\\AMT\\Trace\\trace.bat")
#pr = win32process.CreateProcess(None, 
"D:\\Marian\\Proiecte\\AMT\\Trace\\trace.bat", None, None, 0, 
win32process.NORMAL_PRIORITY_CLASS, None, None, win32process.STARTUPINFO())
print "OK!!!"




But, when I call the "os.startfile("launch_trace.bat")" command, the program 
prompter appears, but the program called in the batch file is opened ONLY after 
the whole script has finished the execution.
Unfortunatley, after this line there are some very important things that has to 
be executed in the right order. I mean, the execution of the batch file is 
important for the rest of the code.
What is strange is that if I execute this code step-by-step, using the 
debugger, or if I put a breakpoint on the "launch_trace" line and then I step 
on it, everything is working fine - the Trace application is launced correctly.
Could anyone help in this direction? I need to launch the application and after 
this I want to continue the execution of the script.
Thank you in advance!
P.S. I've also tried with processes (see the commented lines) and I get the 
same problems; for MSWord application, the behavior is the same - it is 
launched after the script ends. Also, I have to mention that I don't have a DLL 
of this application and it is not a COM application in order to control it from 
Python.
Marian


  --
http://mail.python.org/mailman/listinfo/python-list

Problems calling batch files (*.bat) from Python???

2008-08-23 Thread Marian Popa
Hello,
 
I am new in Python programming and I have the following problem:
I have a script in which I need to open an application (called from a batch 
file - "trace.bat"). For this purpuse, I'm executing the following piece of 
code:
 
import os, win32process
from win32api import Sleep

os.chdir("D:\\Marian\\Proiecte\\AMT\\Trace")
os.startfile("launch_trace.bat")
#subprocess.call("D:\\Marian\\Proiecte\\AMT\\Trace\\trace.bat")
#pr = win32process.CreateProcess(None, 
"D:\\Marian\\Proiecte\\AMT\\Trace\\trace.bat", None, None, 0, 
win32process.NORMAL_PRIORITY_CLASS, None, None, win32process.STARTUPINFO())





 
But, when I call the "os.startfile("launch_trace.bat")" command, the program 
prompter appears, but the program called in the batch file is opened ONLY after 
the whole script has finished the execution.
Unfortunatley, after this line there are some very important things that has to 
be executed in the right order. I mean, the execution of the batch file is 
important for the rest of the code.
What is strange is that if I execute this code step-by-step, using the 
debugger, or if I put a breakpoint on the "launch_trace" line and then I step 
on it, everything is working fine - the Trace application is launced correctly.
Could anyone help in this direction? I need to launch the application and after 
this I want to continue the execution of the script.
 
Thank you in advance!
 
P.S. I've also tried with processes (see the commented lines) and I get the 
same problems; for MSWord application, the behavior is the same - it is 
launched after the script ends. Also, I have to mention that I don't have a DLL 
of this application and it is not a COM application in order to control it from 
Python.
 
Marian


  --
http://mail.python.org/mailman/listinfo/python-list