Wait for a system command executed in the background
Hello I am new to python and I am really a bad programmer... As a linux user, I use quodlibet for listening to music. Quodlibet allows me to write plugins in python. I am trying to write a plugins to burn a playlist by using cdrecord, and this either in dao or tao mode. The basic of this plugin is the following: - make a temp directory - convert the songs in my playlist into wave files in the temp directory using mplayer and renaming them with 3 digits number so that the order of my playlist is conserved - normalize the wave files - burn the cd - delete the temp directory. At the time, I have a working solution (not fully developped by myself...), but in this solution os.system is used to start the different shell commands and the commands do not have a & at the end. Therefore during the whole execution of the plugin, quodlibet is not responsive. What I would like to is program the whole such that I can use & at the end of the shell commands and each command to be executed one after the other! (I tried to put & simply at the end of each shell command with the result that each where started at the same time) Here is the plugin: ### import os, string, re import util import sys import shutil from qltk import ErrorMessage from shutil import copy from plugins.songsmenu import SongsMenuPlugin class _Base(SongsMenuPlugin): PLUGIN_ICON = 'gtk-cdrom' PLUGIN_VERSION = '0.1' # XXX : pb potentiel: si deux utilisateurs utilisent ce plugin # en meme temps, ils vont se marcher sur les pieds... destdir = "/tmp/cd_QL" convert_cmd = "mplayer -ao pcm:file=%(dest)s %(source)s" normalize_cmd = "normalize -m %(path)s/*.wav" burn_cmd = "cdrecord -v -eject %(flags)s -pad -audio %(path)s/*.wav" burn_flags = '' def plugin_songs(self, songs): if not self.check_mplayer(): return self.setup() try: try: for num, song in enumerate(songs): self.makewav(song, num) self.normalize() self.burn() except Exception, e: ErrorMessage( None, "Unknown error", "An error occured while processing files:\n%s." % e ).run() finally: self.teardown() def check_mplayer(self): if not util.iscommand("mplayer"): ErrorMessage( None, "Mplayer not found", "Mplayer is used to convert files in wave files." ).run() return False return True def setup(self): os.mkdir(self.destdir) def makewav(self, song, num): source = song['~filename'].replace(" ", "\ ").replace("'","\\'") dest = os.path.join(self.destdir, "%03d.wav" % num) cmd = self.convert_cmd % dict(source=source, dest=dest) os.system(cmd) def normalize(self): os.system(self.normalize_cmd % dict(path=self.destdir)) def burn(self): flags = self.burn_flags cmd = self.burn_cmd % dict(path=self.destdir, flags=flags) os.system(cmd) def teardown(self): shutil.rmtree(self.destdir) class DAO(_Base): PLUGIN_ID = 'Burn CD w/o blanks' PLUGIN_NAME = _('Burn CD w/o blanks') PLUGIN_DESC = 'Burn CD w/o blanks.' burn_flags = '-dao' class TAO(_Base): PLUGIN_ID = 'Burn CD with blanks' PLUGIN_NAME = _('Burn CD with blanks') PLUGIN_DESC = 'Burn CD with blanks.' # on exporte seulement ces deux classes __all__ = ['DAO', 'TAO'] # and yeah, please consider that I am new to python and do understand something to the thread! Thanks in advance -- Brice Arch Linux (Linux user nb. 372699) - "Unix IS user friendly, it is just selective about who his friends are" -- http://mail.python.org/mailman/listinfo/python-list
Re: Wait for a system command executed in the background
On 2006-11-05, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 5 Nov 2006 18:32:39 +0100, Brice ><[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > > >> >> At the time, I have a working solution (not fully developped by >> myself...), but in this solution os.system is used to start the >> different shell commands and the commands do not have a & at the end. >> Therefore during the whole execution of the plugin, quodlibet is not >> responsive. >> > Might it not be easier to just write each of those commands to a > temporary file, then at the end submit that file as a shell script that > runs in the background? {Maybe the last command should be one the > deletes the file itself?} > At the time being I don't see other possible solution. Let's see if someone else's got an idea. Thx -- Brice Arch Linux (Linux user nb. 372699) - "Unix IS user friendly, it is just selective about who his friends are" -- http://mail.python.org/mailman/listinfo/python-list
How to display a database table on my widget using tkinter
Hi i created a widget that i connected my sql server database. my goal is to put and display data into my database from my widget. i can put data into my database table but my problem is how to display these data on my widget like a table...thanks you at all -- https://mail.python.org/mailman/listinfo/python-list
how to generate a wsdl file for a web service in python
hi to all I am new to python and as part of my project I would like to create a SOAP web service. for now I've developed my python file with all the methods of my future web service, but my problem now is how to generate the wsdl file ... my concern may seem to move so bear with me because I am a novice in this field. thank you in advance -- https://mail.python.org/mailman/listinfo/python-list
Re: how to generate a wsdl file for a web service in python
Le jeudi 18 décembre 2014 11:46:00 UTC, Burak Arslan a écrit : > On 12/18/14 11:58, brice DORA wrote: > > hi to all I am new to python and as part of my project I would like to > > create a SOAP web service. for now I've developed my python file with all > > the methods of my future web service, but my problem now is how to generate > > the wsdl file ... my concern may seem to move so bear with me because I am > > a novice in this field. thank you in advance > > > Hi, > > You can use Spyne to generate the wsdl file. > > http://spyne.io/docs/2.10/manual/02_helloworld.html > https://github.com/arskom/spyne/blob/master/examples/helloworld_soap.py > > There's also s...@python.org for your soap-specific questions. > > best, > burak okey thanks u but this example use a simple method then in my case i have already my python file which contains all methods of my web service. so do you give a example or tell me how i can do it... i want to create the web service and deploying it from my python file...thanks very much in advance -- https://mail.python.org/mailman/listinfo/python-list
Deploying a webservice in python
I created a web service with python tornado framework. I can test it via SoapUI and everything works now my challenge is to be able to deploy in itself and I do not know the procedures or at least the lib that can make this task much aisée..je works with python 2.7 thank you in advance for your help. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to generate a wsdl file for a web service in python
Le dimanche 21 décembre 2014 12:31:50 UTC, Burak Arslan a écrit : > On 12/19/14 12:45, brice DORA wrote: > > i have already my python file which contains all methods of my web service. > > so do you give a example or tell me how i can do it... > > No, all you need is there in that example. > > You need to decorate your functions using Spyne's @rpc, denote > input/output types using Spyne's type markers, wrap it inside a subclass > of Spyne's ServiceBase, pass the resulting service class to a Spyne > application setting your input/output protocols (you probably want Soap) > and pass that application to a transport of your choice (you probably > want WsgiApplication). If you need a Wsgi server, use CherryPy. > > Bon courage, > Burak hi tkanks for your help but i used tornado to create my web service and it worked good and it generate my wsdl file -- https://mail.python.org/mailman/listinfo/python-list
how to create a soap enveloppe with python suds for consume a bssv web service
Hi all I am working on a app in python and I have to call a web service deployed on JDE (bssv). I use it for the suds lib which seems pretty friendly. but the problem is the JDE web service that uses bssv technology necessarily requires sending a soap envelope. as far as I spend my fesais parameters required in my suds client. My concern then is how to work around this problem, or is this possible to create a soap envelope with suds? thank you in advance -- https://mail.python.org/mailman/listinfo/python-list
Re: how to create a soap enveloppe with python suds for consume a bssv web service
Le jeudi 8 janvier 2015 07:53:12 UTC, dieter a écrit : > brice DORA writes: > > > Hi all I am working on a app in python and I have to call a web service > > deployed on JDE (bssv). I use it for the suds lib which seems pretty > > friendly. but the problem is the JDE web service that uses bssv technology > > necessarily requires sending a soap envelope. as far as I spend my fesais > > parameters required in my suds client. My concern then is how to work > > around this problem, or is this possible to create a soap envelope with > > suds? thank you in advance > > "suds" should generate those required "SOAP envelope". > > "suds" can be set up to log the precise messages sent and received > (consult the "suds" documentation about logging and the Python > documentation about its "logging" module). With these messages > (and a precise description of the encountered problem), you can > contact someone responsible for the web service to resolve your problems. okey thanks for your help but can you tell me if it's possible to see the content of this soap envelope that's sent by suds? if yes then please how can i do it?thanks you in advance -- https://mail.python.org/mailman/listinfo/python-list
How can i use a dictionnary
i consume a web service that return a element whose the type is "instance". but this element seem be a dictionary but when i want to use it like a dictionary, i got some errors. so this is the element and please someone can tell me how can i use it. tkanks in advance. (tCountryInfo){ sISOCode = "CI" sName = "Côte D'Ivoire (Ivory Coast)" sCapitalCity = "Yamoussoukro" sPhoneCode = "225" sContinentCode = "AF" sCurrencyISOCode = "XOF" sCountryFlag = "http://www.oorsprong.org/WebSamples.CountryInfo/Images/Côte D'Ivoire.jpg" Languages = (ArrayOftLanguage){ tLanguage[] = (tLanguage){ sISOCode = "fr" sName = "French" }, } } -- https://mail.python.org/mailman/listinfo/python-list
Re: How can i use a dictionnary
Le mardi 13 janvier 2015 14:56:24 UTC, Novocastrian_Nomad a écrit : > On Tuesday, January 13, 2015 at 2:03:30 AM UTC-7, brice DORA wrote: > > i consume a web service that return a element whose the type is "instance". > > but this element seem be a dictionary but when i want to use it like a > > dictionary, i got some errors. so this is the element and please someone > > can tell me how can i use it. tkanks in advance. > > > > > > (tCountryInfo){ > >sISOCode = "CI" > >sName = "Côte D'Ivoire (Ivory Coast)" > >sCapitalCity = "Yamoussoukro" > >sPhoneCode = "225" > >sContinentCode = "AF" > >sCurrencyISOCode = "XOF" > >sCountryFlag = > > "http://www.oorsprong.org/WebSamples.CountryInfo/Images/Côte D'Ivoire.jpg" > >Languages = > > (ArrayOftLanguage){ > > tLanguage[] = > > (tLanguage){ > >sISOCode = "fr" > >sName = "French" > > }, > > } > > } > > This data is not a Python dictionary, nor is it a JSON object. You will > probably need to code your own conversion function to make it a Python > dictionary. thanks for your help but can you give a example that's you tell about my own conversion funcion. thanks in advance -- https://mail.python.org/mailman/listinfo/python-list
Re: How can i use a dictionnary
Le mardi 13 janvier 2015 16:01:22 UTC, rand...@fastmail.us a écrit : > On Tue, Jan 13, 2015, at 04:03, brice DORA wrote: > > i consume a web service that return a element whose the type is > > "instance". but this element seem be a dictionary but when i want to use > > it like a dictionary, i got some errors. so this is the element and > > please someone can tell me how can i use it. tkanks in advance. > > Do you have any more information about this web service, so that you can > find a formal specification (or at least name) of the output format, or > maybe a way to make it return XML or JSON instead? how can i return it in XML or JSON i can say what lib can permit me to do it easier? -- https://mail.python.org/mailman/listinfo/python-list
Re: building a GUI
On Sep 23, 4:28 pm, stef mientki <[EMAIL PROTECTED]> wrote: > yadin wrote: > > if i were up to make a GUI chich are the advantages of choosing python > > over matlab or java? > > As MatLab has a very lousy GUI, > any other language would be an advantage ;-) > > The best is Delphi, > second is VB, > then comes SciLab, Python, etc > I don't know where Java fits in. > > But as Wildemar said, your question is much to broad. > > cheers, > Stef Form a newbie's point of view, Java's Swing Libraries (gui stuff) are pretty easy to get to grips with, if a bit big. They are also incredibly well documented, and are distributed by sun with the core language. Compared to most python toolkits, they are approximately as complex, but far better documented. The other good thing compared to python is their integration at the language API level rather than as a supplementary module. A quick look at the 1.6 swing tutorial will tell you whether this is something you'd like to use: http://java.sun.com/docs/books/tutorial/uiswing/start/index.html hope this helps brice -- http://mail.python.org/mailman/listinfo/python-list
Memory allocation problem with python 2.4.3
Hi, I'm encountering an odd problem while running a python script which calls a C program called 'st_time' : Traceback (most recent call last): File "ccdd.py", line 177, in ? answer=proc_request(conn,addr,request) # proc the request File "ccdd.py", line 69, in proc_request answer = '1&%s'%(ccd.exec_function(fct,arg)) File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 204, in exec_function return apply(self.funcs[name],args) File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 731, in mpose answer = self.download() File "/opt/OFXB/lib/python2.4/site-packages/ccdlib.py", line 1152, in download st = libastro.st_time(ut,LON) File "/opt/OFXB/lib/python2.4/site-packages/libastro.py", line 169, in st_time raise e OSError: [Errno 12] Cannot allocate memory This error is far from appearing each time I invoke st_time. To debug this problem, a friend of mine tried to get memory information as soon as this error is raised. Here, it returns : MemTotal: 774856 kB MemFree: 22952 kB Buffers: 3656 kB Cached: 127600 kB SwapCached: 6308 kB Active: 626132 kB Inactive:75452 kB HighTotal: 0 kB HighFree:0 kB LowTotal: 774856 kB LowFree: 22952 kB SwapTotal: 1116476 kB SwapFree: 647064 kB Dirty: 12 kB Writeback: 0 kB Mapped: 621524 kB Slab:28268 kB CommitLimit: 1503904 kB Committed_AS: 1146312 kB PageTables: 2472 kB VmallocTotal: 245752 kB VmallocUsed: 8992 kB VmallocChunk: 236384 kB Nothing indicates a lack of memory. I'm running the following version of python : Python 2.4.3 (#2, Apr 27 2006, 14:43:58) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] Does somebody has an idea about what's happening ? Many thanks for your time, Brice -- http://mail.python.org/mailman/listinfo/python-list