delete from pattern to pattern if it contains match
HI All, can you help me out in doing below. file: guava fruit mango fruit orange fruit need to delete from start to end if it contains mango in a file... output should be: guava fruit orange fruit Thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 18, 2016 at 1:19:43 PM UTC+5:30, Joaquin Alzola wrote: > Hi, > > Try to use the xml module. > > import xml.etree.ElementTree as ET > > That might help. > > BR > > Joaquin > > -Original Message- > > > HI All, > > can you help me out in doing below. > > file: > > guava > fruit > > > mango > fruit > > > orange > fruit > > > need to delete from start to end if it contains mango in a file... > > output should be: > > > guava > fruit > > > orange > fruit > > > Thank you > -- > https://mail.python.org/mailman/listinfo/python-list > This email is confidential and may be subject to privilege. If you are not > the intended recipient, please do not copy or disclose its content but > contact the sender immediately upon receipt. Hi Alzola, Still any easier way ?? -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 18, 2016 at 1:19:43 PM UTC+5:30, Joaquin Alzola wrote: > Hi, > > Try to use the xml module. > > import xml.etree.ElementTree as ET > > That might help. > > BR > > Joaquin > > -Original Message- > From: Python-list > [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf > Of harirammano...@gmail.com > Sent: 18 April 2016 08:08 > To: python-list@python.org > Subject: delete from pattern to pattern if it contains match > > > HI All, > > can you help me out in doing below. > > file: > > guava > fruit > > > mango > fruit > > > orange > fruit > > > need to delete from start to end if it contains mango in a file... > > output should be: > > > guava > fruit > > > orange > fruit > > > Thank you > -- > https://mail.python.org/mailman/listinfo/python-list > This email is confidential and may be subject to privilege. If you are not > the intended recipient, please do not copy or disclose its content but > contact the sender immediately upon receipt. hi Alzola, xml parsing solution works fine only in the below case if input file is in below format. guava fruit mango fruit orange fruit its not working if the input file as below, just a change in the starting header... http://xmlns.jcp.org/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; version="3.1"> guava fruit mango fruit orange fruit inthis case its not working pls suggest what i have to do to make it work.. -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram...@gmail.com wrote: > HI All, > > can you help me out in doing below. > > file: > > guava > fruit > > > mango > fruit > > > orange > fruit > > > need to delete from start to end if it contains mango in a file... > > output should be: > > > guava > fruit > > > orange > fruit > > > Thank you any one can guide me ? why xml tree parsing is not working if i have root.tag and root.attrib as mentioned in earlier post... -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Thursday, April 21, 2016 at 7:03:00 PM UTC+5:30, Jussi Piitulainen wrote: > harirammano...@gmail.com writes: > > > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, > > hariram...@gmail.com wrote: > >> HI All, > >> > >> can you help me out in doing below. > >> > >> file: > >> > >> guava > >> fruit > >> > >> > >> mango > >> fruit > >> > >> > >> orange > >> fruit > >> > >> > >> need to delete from start to end if it contains mango in a file... > >> > >> output should be: > >> > >> > >> guava > >> fruit > >> > >> > >> orange > >> fruit > >> > >> > >> Thank you > > > > any one can guide me ? why xml tree parsing is not working if i have > > root.tag and root.attrib as mentioned in earlier post... > > Assuming the real consists of lines between a start marker and end > marker, a winning plan is to collect a group of lines, deal with it, and > move on. > > The following code implements something close to the plan. You need to > adapt it a bit to have your own source of lines and to restore the end > marker in the output and to account for your real use case and for > differences in taste and judgment. - The plan is as described above, but > there are many ways to implement it. > > from io import StringIO > > text = '''\ > > guava > fruit > > > mango > fruit > > > orange > fruit > > ''' > > def records(source): > current = [] > for line in source: > if line.startswith(''): > yield current > current = [] > else: > current.append(line) > > def hasmango(record): > return any('mango' in it for it in record) > > for record in records(StringIO(text)): > hasmango(record) or print(*record) Hi, not workingthis is the output i am getting... \ guava fruit orange fruit -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Thursday, April 21, 2016 at 4:55:18 PM UTC+5:30, Peter Otten wrote: > harirammano...@gmail.com wrote: > > > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram...@gmail.com > > wrote: > >> HI All, > >> > >> can you help me out in doing below. > >> > >> file: > >> > >> guava > >> fruit > >> > >> > >> mango > >> fruit > >> > >> > >> orange > >> fruit > >> > > Is that literally what you have in the file? > > > any one can guide me ? why xml tree parsing is not working if i have > > root.tag and root.attrib as mentioned in earlier post... > > The data above is not valid xml. Instead of > > ... > > you need > > ... > > i. e. the end tag must be the same as the start tag, but with a leading "/". @peter yes here it is not xml, but real data is an xml..believe me.. -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Friday, April 22, 2016 at 2:30:45 PM UTC+5:30, hariram...@gmail.com wrote: > On Thursday, April 21, 2016 at 4:55:18 PM UTC+5:30, Peter Otten wrote: > > harirammano...@gmail.com wrote: > > > > > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram...@gmail.com > > > wrote: > > >> HI All, > > >> > > >> can you help me out in doing below. > > >> > > >> file: > > >> > > >> guava > > >> fruit > > >> > > >> > > >> mango > > >> fruit > > >> > > >> > > >> orange > > >> fruit > > >> > > > > Is that literally what you have in the file? > > > > > any one can guide me ? why xml tree parsing is not working if i have > > > root.tag and root.attrib as mentioned in earlier post... > > > > The data above is not valid xml. Instead of > > > > ... > > > > you need > > > > ... > > > > i. e. the end tag must be the same as the start tag, but with a leading "/". > > @peter yes here it is not xml, but real data is an xml..believe me.. @peter this is the similar xml i am having, you can correlate. https://tomcat.apache.org/tomcat-5.5-doc/appdev/web.xml.txt -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Friday, April 22, 2016 at 3:20:53 PM UTC+5:30, Peter Otten wrote: > harirammano...@gmail.com wrote: > > >> @peter yes here it is not xml, but real data is an xml..believe me.. > > > > @peter this is the similar xml i am having, you can correlate. > > > > https://tomcat.apache.org/tomcat-5.5-doc/appdev/web.xml.txt > > This is still too vague. > > If you post the code you actually tried in a small standalone script > together with a small sample xml file that produces the same failure as your > actual data I or someone might help you fix it. yeah peter you are correct, i would have done that atleast by changing the strings, but i wasnt as here its an restricted data and the purpose...so i have taken sample xml data...ofcourse tags are missed.. -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Friday, April 22, 2016 at 4:41:08 PM UTC+5:30, Jussi Piitulainen wrote: > Peter Otten writes: > > > harirammano...@gmail.com wrote: > > > >> On Thursday, April 21, 2016 at 7:03:00 PM UTC+5:30, Jussi Piitulainen > >> wrote: > >>> harirammano...@gmail.com writes: > >>> > >>> > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, > >>> > hariram...@gmail.com wrote: > >>> >> HI All, > >>> >> > >>> >> can you help me out in doing below. > >>> >> > >>> >> file: > >>> >> > >>> >> guava > >>> >> fruit > >>> >> > >>> >> > >>> >> mango > >>> >> fruit > >>> >> > >>> >> > >>> >> orange > >>> >> fruit > >>> >> > >>> >> > >>> >> need to delete from start to end if it contains mango in a file... > >>> >> > >>> >> output should be: > >>> >> > >>> >> > >>> >> guava > >>> >> fruit > >>> >> > >>> >> > >>> >> orange > >>> >> fruit > >>> >> > >>> >> > >>> >> Thank you > >>> > > >>> > any one can guide me ? why xml tree parsing is not working if i have > >>> > root.tag and root.attrib as mentioned in earlier post... > >>> > >>> Assuming the real consists of lines between a start marker and end > >>> marker, a winning plan is to collect a group of lines, deal with it, and > >>> move on. > >>> > >>> The following code implements something close to the plan. You need to > >>> adapt it a bit to have your own source of lines and to restore the end > >>> marker in the output and to account for your real use case and for > >>> differences in taste and judgment. - The plan is as described above, but > >>> there are many ways to implement it. > >>> > >>> from io import StringIO > >>> > >>> text = '''\ > >>> > >>> guava > >>> fruit > >>> > >>> > >>> mango > >>> fruit > >>> > >>> > >>> orange > >>> fruit > >>> > >>> ''' > >>> > >>> def records(source): > >>> current = [] > >>> for line in source: > >>> if line.startswith(''): > >>> yield current > >>> current = [] > >>> else: > >>> current.append(line) > >>> > >>> def hasmango(record): > >>> return any('mango' in it for it in record) > >>> > >>> for record in records(StringIO(text)): > >>> hasmango(record) or print(*record) > >> > >> Hi, > >> > >> not workingthis is the output i am getting... > >> > >> \ > > > > This means that the line > > > >>> text = '''\ > > > > has trailing whitespace in your copy of the script. > > That's a nuisance. I wish otherwise undefined escape sequences in > strings raised an error, similar to a stray space after a line > continuation character. > > >> > >>guava > >> fruit > >> > >> > >>orange > >> fruit > > > > Jussi forgot to add the "..." line to the group. > > I didn't forget. I meant what I said when I said the OP needs to adapt > the code to (among other things) restore the end marker in the output. > If they can't be bothered to do anything at all, it's their problem. > > It was already known that this is not the actual format of the data. > > > To fix this change the generator to > > > > def records(source): > > current = [] > > for line in source: > > current.append(line) > > if line.startswith(''): > > yield current > > current = [] > > Oops, I notice that I forgot to start a new record only on encountering > a '' line. That should probably be done, unless the format is > intended to be exactly a sequence of "\n- -\n\n". > > >>> hasmango(record) or print(*record) > > > > The > > > > print(*record) > > > > inserts spaces between record entries (i. e. at the beginning of all > > lines except the first) and adds a trailing newline. > > Yes, I forgot about the space. Sorry about that. > > The final newline was intentional. Perhaps I should have added the end > marker there instead (given my preference to not drag it together with > the data lines), like so: > >print(*record, sep = "", end = "\n") > > Or so: > >print(*record, sep = "") >print("") > > Or so: > >for line in record: >print(line.rstrip("\n") >else: >print("") > > Or: > >for line in record: >print(line.rstrip("\n") >else: >if record and not record[-1].strip() == "": >print("") > > But all this is beside the point that to deal with the stated problem > one might want to obtain access to a whole record *first*, then check if > it contains "mango" in the intended way (details missing but at least > "mango\n" as a full line counts as an occurrence), and only *then* print > the whole record (if it doesn't contain "mango"). > > I can think of two other ways - one if the data can be accessed only > once - but they seem more complicated to me. Hm, well, if it's XML, as > stated in another branch of this thread and contrary to the form of the > example data in this branch, there's a third way that may be good, but > here I'm responding to a line-oriented format. > > > You can avoid this by specifying the delimiters explicitly: > >
Re: delete from pattern to pattern if it contains match
On Monday, April 25, 2016 at 12:47:14 PM UTC+5:30, Jussi Piitulainen wrote: > harirammano...@gmail.com writes: > > > Hi Jussi, > > > > i have seen you have written a definition to fulfill the requirement, > > can we do this same thing using xml parser, as i have failed to > > implement the thing using xml parser of python if the file is having > > the content as below... > > > > > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > > "http://java.sun.com/dtd/web-app_2_3.dtd";> > > > > > > > > and entire thing works if it has as below: > > > > > > > what i observe is xml tree parsing is not working if http tags are > > there in between web-app... > > Do you get an error message? > > My guess is that the parser needs the DTD but cannot access it. There > appears to be a DTD at that address, http://java.sun.com/... (it > redirects to Oracle, who bought Sun a while ago), but something might > prevent the parser from accessing it by default. If so, the details > depend on what parser you are trying to use. It may be possible to save > that DTD as a local file and point the parser to that. > > Your problem is morphing rather wildly. A previous version had namespace > declarations but no DTD or XSD if I remember right. The initial version > wasn't XML at all. > > If you post (1) an actual, minimal document, (2) the actual Python > commands that fail to parse it, and (3) the error message you get, > someone will be able to help you. The content of the document need not > be more than "hello, world" level. The DOCTYPE declaration and the > outermost tags with all their attributes and namespace declarations, if > any, are important. Hi Jussi, Here is an input file...sample.xml http://xmlns.jcp.org/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; version="3.1"> controller com.mycompany.mypackage.ControllerServlet listOrders com.mycompany.myactions.ListOrdersAction saveCustomer com.mycompany.myactions.SaveCustomerAction 5 graph /graph 30 Here is the code: import xml.etree.ElementTree as ET ET.register_namespace("", "http://xmlns.jcp.org/xml/ns/javaee";) tree = ET.parse('sample.xml') root = tree.getroot() for servlet in root.findall('servlet'): servletname = servlet.find('servlet-name').text if servletname == "controller": root.remove(servlet) tree.write('output.xml') This will work if doesnt have below... xmlns="http://xmlns.jcp.org/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 25, 2016 at 3:19:15 PM UTC+5:30, hariram...@gmail.com wrote: > On Monday, April 25, 2016 at 12:47:14 PM UTC+5:30, Jussi Piitulainen wrote: > > harirammano...@gmail.com writes: > > > > > Hi Jussi, > > > > > > i have seen you have written a definition to fulfill the requirement, > > > can we do this same thing using xml parser, as i have failed to > > > implement the thing using xml parser of python if the file is having > > > the content as below... > > > > > > > > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > > > "http://java.sun.com/dtd/web-app_2_3.dtd";> > > > > > > > > > > > > and entire thing works if it has as below: > > > > > > > > > > > what i observe is xml tree parsing is not working if http tags are > > > there in between web-app... > > > > Do you get an error message? > > > > My guess is that the parser needs the DTD but cannot access it. There > > appears to be a DTD at that address, http://java.sun.com/... (it > > redirects to Oracle, who bought Sun a while ago), but something might > > prevent the parser from accessing it by default. If so, the details > > depend on what parser you are trying to use. It may be possible to save > > that DTD as a local file and point the parser to that. > > > > Your problem is morphing rather wildly. A previous version had namespace > > declarations but no DTD or XSD if I remember right. The initial version > > wasn't XML at all. > > > > If you post (1) an actual, minimal document, (2) the actual Python > > commands that fail to parse it, and (3) the error message you get, > > someone will be able to help you. The content of the document need not > > be more than "hello, world" level. The DOCTYPE declaration and the > > outermost tags with all their attributes and namespace declarations, if > > any, are important. > > Hi Jussi, > > Here is an input file...sample.xml > > > http://xmlns.jcp.org/xml/ns/javaee"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee > http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; > version="3.1"> > > controller > com.mycompany.mypackage.ControllerServlet > > listOrders > com.mycompany.myactions.ListOrdersAction > > > saveCustomer > com.mycompany.myactions.SaveCustomerAction > > 5 > > > > > graph > /graph > > > > > 30 > > > > > Here is the code: > > import xml.etree.ElementTree as ET > ET.register_namespace("", "http://xmlns.jcp.org/xml/ns/javaee";) > tree = ET.parse('sample.xml') > root = tree.getroot() > > for servlet in root.findall('servlet'): > servletname = servlet.find('servlet-name').text > if servletname == "controller": > root.remove(servlet) > > tree.write('output.xml') > > This will work if doesnt have below... > > xmlns="http://xmlns.jcp.org/xml/ns/javaee"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee > http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; By the way i didnt get any error message and i am using version 3.4.3 -- https://mail.python.org/mailman/listinfo/python-list
Re: Writing different sections into a file
On Monday, April 25, 2016 at 1:01:12 PM UTC+5:30, Palpandi wrote: > Hi, > > I need to write different sections into a file. > At any point of time, content can be added to any section. > > I don't want keep each section into a temporary file. > What is the better way to store the contents of each section and write them > into a file at the end? > What is the better datatype to achieve this? > > > Thanks and Regards, > Palpandi use ConfigParser.. -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 25, 2016 at 4:09:26 PM UTC+5:30, Jussi Piitulainen wrote: > Peter Otten writes: > > > harirammano...@gmail.com wrote: > > > >> Here is the code: > > > > Finally ;) > > :) name space issue can be resolved registering name space i have no issue with that, only concern is xml parser has no effect when http things are added... -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 25, 2016 at 4:58:15 PM UTC+5:30, Jussi Piitulainen wrote: > harirammano...@gmail.com writes: > > > On Monday, April 25, 2016 at 4:09:26 PM UTC+5:30, Jussi Piitulainen wrote: > >> Peter Otten writes: > >> > >> > harirammano...@gmail.com wrote: > >> > > >> >> Here is the code: > >> > > >> > Finally ;) > >> > >> :) > > > > name space issue can be resolved registering name space i have no > > issue with that, only concern is xml parser has no effect when http > > things are added... > > No, the parser works fine. Your attempt to register a default namespace > didn't work. Those "http things" *are* the namespace issue! > > The following version of your code works. *Try it.* It finds the servlet > element in the document object, removes it, and writes out XML text > without the servlet element. (It seems to invent another namespace > prefix. That doesn't change the meaning of the document.) > > import xml.etree.ElementTree as ET > > ns = { 'x' : "http://xmlns.jcp.org/xml/ns/javaee"; } > > tree = ET.parse('sample.xml') > root = tree.getroot() > > for servlet in root.findall('x:servlet', ns): > servletname = servlet.find('x:servlet-name', ns).text > if servletname == "controller": > root.remove(servlet) > > tree.write('output.xml') yup its working well if i include register namespace, else i am getting ns:0 in every line of output.xml. But its removing top line -- https://mail.python.org/mailman/listinfo/python-list
Re: delete from pattern to pattern if it contains match
On Monday, April 25, 2016 at 6:04:24 PM UTC+5:30, Peter Otten wrote: > harirammano...@gmail.com wrote: > > >> tree.write('output.xml') > > > > yup its working well if i include register namespace, else i am getting > > ns:0 in every line of output.xml. > > > > But its removing top line > > > > The write() method allows you to specify an encoding and/or require an xml > declaration: > > https://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write Hi Peter, Thanks for reminding about basic write method syntax...its working :) http://xmlns.jcp.org/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="3.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd";> graph /graph 30 Here is the change: tree.write('output.xml',encoding="ISO-8859-1",xml_declaration=True) Thank you all especially jussi and pete.. -- https://mail.python.org/mailman/listinfo/python-list
pygame easy create
is there anyway (IDE/package) that allows me to create graphics/game just like that (by instructing..., if i say create hills on the screen, it should generate pygame code)Anyway :) :) -- https://mail.python.org/mailman/listinfo/python-list
Re: pypi download links (e.g. for ansible)
On Monday, May 9, 2016 at 3:30:31 PM UTC+5:30, Michael Ströder wrote: > HI! > > Deep-links for downloading a specific version from PyPI seemed to work like > this: > > $ wget > https://pypi.python.org/packages/source/a/ansible/ansible-2.0.1.0.tar.gz > [..] > Saving to: 'ansible-2.0.1.0.tar.gz' > > But this recent version does not work: > > $ wget > https://pypi.python.org/packages/source/a/ansible/ansible-2.0.2.0.tar.gz > [..] > HTTP request sent, awaiting response... 404 Not Found > > Ciao, Michael. how its working for you, for me it says ssl connection error,if i do wget from linux as root user. -- https://mail.python.org/mailman/listinfo/python-list
Re: pygame easy create
On Monday, May 9, 2016 at 10:50:47 AM UTC+5:30, hariram...@gmail.com wrote: > is there anyway (IDE/package) that allows me to create graphics/game just > like that (by instructing..., if i say create hills on the screen, it should > generate pygame code)Anyway :) :) Atleast i tried with pyglet,felt that it will be easier than pygame. still again throwing me error some GL is missed, why they wont be straight forward in working if we select the env we have... some sites says 2.7 and >=3(3.4+) will have pip module by default, but i am using 3.4.3 where i dont have pip and also tried python get-pip.py which also not worked.. -- https://mail.python.org/mailman/listinfo/python-list
Re: pygame easy create
On Monday, May 9, 2016 at 10:50:47 AM UTC+5:30, hariram...@gmail.com wrote: > is there anyway (IDE/package) that allows me to create graphics/game just > like that (by instructing..., if i say create hills on the screen, it should > generate pygame code)Anyway :) :) is there any way to create high graphics game using python, else its waste to learn pygame. is there any module is there to create high grapihc game modules... -- https://mail.python.org/mailman/listinfo/python-list
Re: pygame easy create
On Monday, May 9, 2016 at 11:12:47 PM UTC+5:30, sohca...@gmail.com wrote: > On Monday, May 9, 2016 at 3:15:45 AM UTC-7, hariram...@gmail.com wrote: > > On Monday, May 9, 2016 at 10:50:47 AM UTC+5:30, hariram...@gmail.com wrote: > > > is there anyway (IDE/package) that allows me to create graphics/game just > > > like that (by instructing..., if i say create hills on the screen, it > > > should generate pygame code)Anyway :) :) > > > > Atleast i tried with pyglet,felt that it will be easier than pygame. > > still again throwing me error some GL is missed, why they wont be straight > > forward in working if we select the env we have... > > > > some sites says 2.7 and >=3(3.4+) will have pip module by default, but i am > > using 3.4.3 where i dont have pip and also tried python get-pip.py which > > also not worked.. > > "still again throwing me error some GL is missed" > > Can you say *EXACTLY* what the error is? And can you copy/paste the relevant > lines of code that lead to that error? > > Also, judging from your other messages, it looks like you might be needing to > read the Python or PyGame tutorials. Programming is problem solving. You > can't just saying "Draw a hill" and PyGame (or whatever module you're using) > will draw a hill. You need to write code that describes how to draw a hill. code: #!/home/python/3.4.3/python import os,sys sys.path.append('/home/python/3.4.3/custommodules/lib/python3.4/site-packages') import pyglet window = pyglet.window.Window() label = pyglet.text.Label('Hello, world', font_name='Times New Roman', font_size=36, x=window.width//2, y=window.height//2, anchor_x='center', anchor_y='center') @window.event def on_draw(): window.clear() label.draw() pyglet.app.run() op: -bash-4.1$ ./pygletpgm.py Traceback (most recent call last): File "./pygletpgm.py", line 5, in import pyglet ImportError: No module named 'pyglet' I am able to successfully install pyglet module in custommodules... another issue: -bash-4.1$ python get-pip.py /tmp/tmpUdukeA/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. Collecting pip /tmp/tmpUdukeA/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. /tmp/tmpUdukeA/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. Could not find a version that satisfies the requirement pip (from versions: ) No matching distribution found for pip -- https://mail.python.org/mailman/listinfo/python-list
Re: pygame easy create
On Monday, May 9, 2016 at 11:12:47 PM UTC+5:30, sohca...@gmail.com wrote: > On Monday, May 9, 2016 at 3:15:45 AM UTC-7, hariram...@gmail.com wrote: > > On Monday, May 9, 2016 at 10:50:47 AM UTC+5:30, hariram...@gmail.com wrote: > > > is there anyway (IDE/package) that allows me to create graphics/game just > > > like that (by instructing..., if i say create hills on the screen, it > > > should generate pygame code)Anyway :) :) > > > > Atleast i tried with pyglet,felt that it will be easier than pygame. > > still again throwing me error some GL is missed, why they wont be straight > > forward in working if we select the env we have... > > > > some sites says 2.7 and >=3(3.4+) will have pip module by default, but i am > > using 3.4.3 where i dont have pip and also tried python get-pip.py which > > also not worked.. > > "still again throwing me error some GL is missed" > > Can you say *EXACTLY* what the error is? And can you copy/paste the relevant > lines of code that lead to that error? > > Also, judging from your other messages, it looks like you might be needing to > read the Python or PyGame tutorials. Programming is problem solving. You > can't just saying "Draw a hill" and PyGame (or whatever module you're using) > will draw a hill. You need to write code that describes how to draw a hill. yeah coding is a problem solving as you said, its right but i have asked any utility is there for easy design in the same fashion okay can you answser my question, using python modules (pygame/pyglet whatever it may be) can we design games with higher graphics (like world of tanks, freedom fighter, mission impossible:rouge nation, contract killer etc) -- https://mail.python.org/mailman/listinfo/python-list
Re: pygame easy create
On Tuesday, May 10, 2016 at 10:51:58 AM UTC+5:30, hariram...@gmail.com wrote: > On Monday, May 9, 2016 at 11:12:47 PM UTC+5:30, sohca...@gmail.com wrote: > > On Monday, May 9, 2016 at 3:15:45 AM UTC-7, hariram...@gmail.com wrote: > > > On Monday, May 9, 2016 at 10:50:47 AM UTC+5:30, hariram...@gmail.com > > > wrote: > > > > is there anyway (IDE/package) that allows me to create graphics/game > > > > just like that (by instructing..., if i say create hills on the screen, > > > > it should generate pygame code)Anyway :) :) > > > > > > Atleast i tried with pyglet,felt that it will be easier than pygame. > > > still again throwing me error some GL is missed, why they wont be > > > straight forward in working if we select the env we have... > > > > > > some sites says 2.7 and >=3(3.4+) will have pip module by default, but i > > > am using 3.4.3 where i dont have pip and also tried python get-pip.py > > > which also not worked.. > > > > "still again throwing me error some GL is missed" > > > > Can you say *EXACTLY* what the error is? And can you copy/paste the > > relevant lines of code that lead to that error? > > > > Also, judging from your other messages, it looks like you might be needing > > to read the Python or PyGame tutorials. Programming is problem solving. > > You can't just saying "Draw a hill" and PyGame (or whatever module you're > > using) will draw a hill. You need to write code that describes how to draw > > a hill. > > yeah coding is a problem solving as you said, its right but i have asked any > utility is there for easy design in the same fashion > > okay can you answser my question, using python modules (pygame/pyglet > whatever it may be) can we design games with higher graphics (like world of > tanks, freedom fighter, mission impossible:rouge nation, contract killer > etc) Traceback (most recent call last): File "./pyg.py", line 6, in window = pyglet.window.Window() File "_build/bdist.linux-x86_64/egg/pyglet/__init__.py", line 357, in __getattr__ File "_build/bdist.linux-x86_64/egg/pyglet/window/__init__.py", line 133, in File "_build/bdist.linux-x86_64/egg/pyglet/gl/__init__.py", line 97, in File "_build/bdist.linux-x86_64/egg/pyglet/gl/lib.py", line 142, in File "_build/bdist.linux-x86_64/egg/pyglet/gl/lib_glx.py", line 50, in File "_build/bdist.linux-x86_64/egg/pyglet/lib.py", line 160, in load_library ImportError: Library "GL" not found. -- https://mail.python.org/mailman/listinfo/python-list