Re: python + php encrypt/decrypt

2011-06-04 Thread hidura

Use xml to pass the encrypt text.

On , Peter Irbizon  wrote:


Hello,


I would like to encrypt text in python and decrypt it in my PHP script. I  
tried to use pycrypto and some aes php scripts but the results are not  
the same. Please, is there any example (the best way source codes) how to  
do this in python and PHP?


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


Online payment

2011-06-25 Thread hidura
Hello i want to create a shopping cart for my web-site, to receive payments  
from credit cards, how can i do this? where i can start to investigate? I  
did all the web-site using Python-3.


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


Re: Re: Online payment

2011-06-25 Thread hidura
I don't use Django or Plone i use my own web-frameowork. Thanks for the  
advice!


El , Florencio Cano  escribió:
> Hello i want to create a shopping cart for my web-site, to receive  
payments


> from credit cards, how can i do this? where i can start to investigate?  
I



> did all the web-site using Python-3.





Did you use any Python web development framework like Django or Plone?



--



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



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


How to re import a module

2011-04-07 Thread hidura
Hello i want to know the best way to re import a module, because i have a  
web server with just one Apache session for all my domains and  
applications, and i if i need to make some changes on one application  
restart the server will affect the others, so i was thinking in 2 ways the  
first will be 're imported' the module, the second use subprocess. First  
the less unsecured that in this case i think is re import the module, give  
me your opinions please.



---
Thanks in advance
Diego Hidalgo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-11 Thread hidura
I am agree with postgresql i don' t have any problem, also is better for big 
applications. And Python is always better language than PHP if you' re going to 
create a web app.
Sent from my BlackBerry® wireless device

-Original Message-
From: Tim Roberts 
Sender: python-list-bounces+hidura=gmail@python.org
Date: Sun, 11 Sep 2011 11:48:01 
To: 
Subject: Re: using python in web applications

"Littlefield, Tyler"  wrote:
>
>I don't much care for PHP, but the thing that can be said for it is it's 
>pretty quick. How does Python compare?

PHP is quick for development, in that you can slap together some schlock
and have it mostly work.  The result, however, is usually schlock.  The
performance of the language itself is almost entirely irrelevant; the
execution time is swamped by the network overhead.

>I'm also curious what databases are suggested? I've always 
>done most of my work in MYSql, but from what I understand postgresql is 
>becoming more popular to.

Well, that's a religious argument.  Personally, I've always been confused
by the draw of MySql.  From the very beginning, Postgres has always been
more powerful, more reliable, more standard-compliant, and more
professional.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Benefits of xml.dom.minidom?

2011-10-20 Thread Hidura
I use minidom all the time and i don' t have that problem could you describe
more of the process ?
El oct 20, 2011 5:53 p.m., "John Gordon"  escribió:
>
> I recently inherited some code that uses xml.dom.minidom to build a large
> XML document, and I noticed that it is quite slow and uses a ton of
memory.
>
> I converted the same code to use lxml.etree and it is much faster and
> uses not nearly so much memory.
>
> Why is minidom so hungry for resources?  What is it doing with all that
> memory and CPU?
>
> --
> John Gordon   A is for Amy, who fell down the stairs
> gor...@panix.com  B is for Basil, assaulted by bears
>-- Edward Gorey, "The Gashlycrumb Tinies"
>
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How convert a list string to a real list

2011-11-30 Thread Hidura
Why you don't make this "['1','2','3']".strip("[]").split(',') work for me
El nov 30, 2011 10:16 p.m., "Terry Reedy"  escribió:

> On 11/30/2011 3:58 AM, Peter Otten wrote:
>
>> Terry Reedy wrote:
>>
>>  On 11/30/2011 1:20 AM, 郭军权 wrote:
>>>
 Good after
 I have a string liststr = '["","","ccc"]' ,and I need convert it
 to a list like list = ["","","ccc"],what can id do?

>>>
>>> The easiest -- and most dangerous -- way is
>>>  >>>  eval('["","","ccc"]')
>>> ['', '', 'ccc']
>>>
>>> But DO NOT eval unexamined strings from untrusted sources. The reason is
>>> that it is much the same as letting an untrusted person sit unsupervised
>>> as the keyboard of your computer with a command window open. You would
>>> not want to eval
>>>"from os import system; system('')"
>>> where '' is replaced by something obnoxious for your
>>> operating system.
>>>
>>
>> You can avoid these problems with ast.literal_eval():
>>
>> literal_eval(node_or_string)
>> Safely evaluate an expression node or a string containing a Python
>> expression.  The string or node provided may only consist of the
>> following Python literal structures: strings, numbers, tuples, lists,
>> dicts, booleans, and None.
>>
>
> I keep forgetting that someone thought to solve the problem of eval being
> both convinient and dangerous. Maybe if I type it once, I will remember.
> >>> import ast
> >>> ast.literal_eval('["","**","ccc"]')
> ['', '', 'ccc']
>
> I think it would be better if safe_eval were available as an easily
> accessible builtin and dangerous_eval were tucked away in a module ;-).
>
> --
> Terry Jan Reedy
>
>
> --
> http://mail.python.org/**mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with __init__.py in Python3.1

2010-02-03 Thread Hidura
Good evening list, I have a really big trouble with the imports in the 3.1
version(Notes: In the older 2.64 theres no problems), I have two packages,
the first package Utilities who contains Writer the second package, Writers
contain the module tagmanip(What is imported in the best way inside the
__init__.py of the Writer), when i make  the import inside the writer
everything is ok, but from the Utilities package the errors says:
"ImportError: No module named tagsmanip".
I don't understand why this is happening, if somebody could help me i will
glad to hear any suggestion.


Atte.
-- 
Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Hidura
Thanks, I read it and try to put my code in the correct form, but now give
me another error, inside the Writer Package says:
"ValueError: Attempted relative import in non-package", if somebody knows a
clue of how fix it i will glad to read opinions. [?]

On Thu, Feb 4, 2010 at 2:11 AM, Gabriel Genellina wrote:

> En Thu, 04 Feb 2010 01:00:56 -0300, Hidura  escribió:
>
>
>  Good evening list, I have a really big trouble with the imports in the 3.1
>> version(Notes: In the older 2.64 theres no problems), I have two packages,
>> the first package Utilities who contains Writer the second package,
>> Writers
>> contain the module tagmanip(What is imported in the best way inside the
>> __init__.py of the Writer), when i make  the import inside the writer
>> everything is ok, but from the Utilities package the errors says:
>> "ImportError: No module named tagsmanip".
>> I don't understand why this is happening, if somebody could help me i will
>> glad to hear any suggestion.
>>
>
> In Python 3.x, "absolute" import is enabled by default (2.6 uses a mix of
> relative and absolute imports).
> To import sibling modules in a package, or modules in a subpackage, you
> have to use relative imports:
>
> from . import tagmanip
> from .Writers import tagmanip
>
> See PEP328 http://www.python.org/dev/peps/pep-0328/
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Hidura
<<330.png>>-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Hidura
Thanks i middle resolve the problem, and i going to read the PEP-366 i've
been read the 328, i will kept informed of the progresses.

Thanks again for the help [?]

On Thu, Feb 4, 2010 at 6:47 PM, Ben Finney

> wrote:

> "Gabriel Genellina"  writes:
>
> > If you directly run a script from inside a package, Python does not
> > know that it belongs to a package, and treats it as a simple, lonely
> > script. In that case, relative imports won't work.
>
> Which I consider to be a bug. Fortunately, it's already addressed in PEP
> 366 http://www.python.org/dev/peps/pep-0366/>. Unfortunately, it
> involves more hackish boilerplate at the top of the program, and is only
> available in Python 2.6+.
>
> --
>  \  “Ignorance more frequently begets confidence than does |
>  `\   knowledge.” —Charles Darwin, _The Descent of Man_, 1871 |
> _o__)  |
> Ben Finney
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Hidura
<<330.png>>-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Problem with __init__.py in Python3.1

2010-02-22 Thread hidura
For finnished the subject i resolve the problem using the PEP-328, i was  
using the old kind of imports :s


On Feb 4, 2010 10:10pm, Hidura  wrote:
Thanks i middle resolve the problem, and i going to read the PEP-366 i've  
been read the 328, i will kept informed of the progresses.



Thanks again for the help



On Thu, Feb 4, 2010 at 6:47 PM, Ben Finney ben+pyt...@benfinney.id.au>  
wrote:



"Gabriel Genellina" gagsl-...@yahoo.com.ar> writes:





> If you directly run a script from inside a package, Python does not



> know that it belongs to a package, and treats it as a simple, lonely



> script. In that case, relative imports won't work.






Which I consider to be a bug. Fortunately, it's already addressed in PEP



366 http://www.python.org/dev/peps/pep-0366/>. Unfortunately, it



involves more hackish boilerplate at the top of the program, and is only



available in Python 2.6+.





--



\ “Ignorance more frequently begets confidence than does |



`\ knowledge.” —Charles Darwin, _The Descent of Man_, 1871 |



_o__) |



Ben Finney




--



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








--
Hidura


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


Web Hosting Python 3

2010-03-16 Thread hidura
Hello list, i am in a project what need hosting, who give hosting to  
python3?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Hosting Python 3

2010-03-17 Thread Hidura
I've saw last night in the help area they support Python3.1, thanks anyway

On Wed, Mar 17, 2010 at 9:22 AM,  wrote:

>  Hidura,
>
> > Hello list, i am in a project what need hosting, who give hosting to
> python3?
>
> Check out www.webfaction.com. I'm extremely pleased with this vendor.
>
> Highly recommended!
>
> Malcolm
>



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


Fetch files from mail in python

2010-03-30 Thread hidura
Hello list, i want to know how could i fetch a file from an email, what  
kind of library i have to use for that, actually i am working in the  
support of IMAP and POP3.


Thanks.


Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Fetch files from mail in python

2010-03-30 Thread hidura
I did that but i want to know if i have a file inside the mail how could i  
download that file from my mail.


On Mar 30, 2010 7:39pm, Chris Rebert  wrote:

On Tue, Mar 30, 2010 at 4:33 PM, hid...@gmail.com> wrote:


> Hello list, i want to know how could i fetch a file from an email, what  
kind


> of library i have to use for that, actually i am working in the support  
of



> IMAP and POP3.





Next time, consult the Global Module Index



(http://docs.python.org/modindex.html) before posting.





IMAP: http://docs.python.org/library/imaplib.html



POP: http://docs.python.org/library/poplib.html





Cheers,



Chris



--



http://blog.rebertia.com


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


Re: Re: Fetch files from mail in python

2010-03-31 Thread hidura

Ok, I will take your advice and implemented in my project.


Thank you all for your help.

On Mar 31, 2010 3:03am, Dennis Lee Bieber  wrote:

On Wed, 31 Mar 2010 00:47:47 +, hid...@gmail.com declaimed the



following in gmane.comp.python.general:




> I did that but i want to know if i have a file inside the mail how  
could i



> download that file from my mail.





Top posting is undesirable...





As for "downloading"... At least with POP3 (I don't do IMAP), there



is NO "downloading" -- all attachments come down with the message.





What you need to do is parse out the portion of the body that



contains the "attachment".









--




Wulfraed Dennis Lee Bieber AF6VN



wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/"  
eudora="autourl">HTTP://wlfraed.home.netcom.com/










--



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


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


Re: Objects versus dictionaries

2010-11-14 Thread Hidura
Use *kargs to pass all the informatio that you need if u want in the
future extended this will be usefull

2010/11/14, Micah Carrick :
> I'm writing a little API that other people will use. There are up to 3
> "objects" that get passed around. One of them has some validation methods,
> the other two simply store data and probably won't have any validation or
> other methods. I only made them objects so that they are syntactically (is
> that a word?) similar the other object rather than using dictionaries. I
> figure it also better allows for changes in the future.
>
> Any thoughts on the pros/cons of using my own objects over a dictionary
> objects?
>
> # this is what I have now...
> stuff = Stuff(foo="foo", bar="bar")
> if stuff.is_valid():
>   cust = Customer(name="John", email="f...@bar.com")
>   order = Order(order_id=1234, amount=12.99)
>   SomeObject.some_method(stuff, cust, order)
>
> # this would also work...
> stuff = Stuff(foo="foo", bar="bar")
> if stuff.is_valid():
>   cust = { 'name': "John", 'email': "f...@bar.com" }
>   order = { 'order_id': 1234, 'amount': 12.99 }
>   SomeObject.some_method(stuff, cust, order)
>
> --
> Micah Carrick
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Printing from Web Page

2010-11-20 Thread Hidura
Explain better what you try to do.

2010/11/20, Victor Subervi :
> Hi;
> I need to be able to print something from a Web page: not the entire page
> but what I specify. I am writing the page and the client is surfing to it.
> How do I do this?
> TIA,
> beno
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A web site using Python

2010-12-04 Thread hidura
I am working on a tool that can create an application like that without  
write server code, but the system is write in Python3.1

On Dec 4, 2010 9:32am, Virgil Stokes  wrote:






I would like to design a web site that can be used to help
people to find a cat



that they can adopt. Note, this is a non-profit project, but one
that I



believe to be quite important. Here are some of my initial
thoughts on this



project.







Site purpose:





To provide a web site for anyone to look at information on cats
at this home, and how



they can adopt one or more of these homeless cats.







Some features of the site:





1. A cat database that I as the web site designer would create.
This database would



contain an entry for each cat available for adoption. It would
include such things



as the name, sex, age, paths to image(s) and/or video(s) of the
cat, health status,



etc (see below).





2. Anyone accessing this site should be able to easily navigate
around it and to



examine entries in this database. The client (designated person
at the home



where the cats are kept for adoption) would be given privileges
to modify the



database (add, delete, and modify entries). The user interface
for the client



to update the database should be very easy to use. This GUI
provided to the



client for modification of the database would be written in
Python.





3. There would be no inputs to this web site. There would be an
embedded link for a



potential customer to send an email to the responsible person
(bringing up



their email client).





4. Track number of visitors to the site.







Preliminary notes on the database



Fields:





- ID code (key)



- Name



- Sex (M / F)



- Neutered / Not neutered



- Age (estimated)



- Type (breed)



- Tagged (chip or ear marking)/ Not tagged



- Checked In date (yy/mm/dd)



- Checked Out date (yy/mm/dd)



- Status (needs home / has home)



- Social state (1,2,3,4,5)



- Health state (1,2,3,4,5)



- Companion state (1,2,3,4,5)



- Image (file name) % multiple files allowed



- Video (file name) % multiple files allowed



- Medical/vet data (text on vaccinations, etc.)



- General information (text on cat that includes comments,
observations, etc.)





---





Notes on database:





* state = 1, Best



5, Worst





Examples:



Social state = 5, very unfriendly, afraid, etc.



3, can touch if careful



1, very friendly, unafraid





Health state = 5, not in good health (eg infection)



3, only minor health problems



1, in very good health





Companion state = 5, must have another cat or cats as company



3, could be with other cat(s) company



1, does not need the company of another cat





Now, with this initial information (granted this is very
rough), my question:





How, armed with Python 2.6 (or 2.7) and all of the Python
packages available,



should I attack the problem of getting this web site up and
running on a Windows



platform?





Please keep in mind that do have some experience with Python and
HTML; but, this



would be my first web site project using Python.





Any suggestions, study plan, references, etc. would be welcomed.





--V




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


Re: A web site using Python

2010-12-06 Thread Hidura
KarinApp will allow you to create an application without writing code, eg:
you want to insert the information of a person in the DB, with all
the current framework you will write a code that takes the data,
and after you will write the insert, and if you want to send a response
you will have to write it too. KarinApp is a framework that comes with
several libraries inside-all writes on Pythn- and like Python is extensible,

so you can create a page and save it-KarinApp has a hosting service so you
can
create pages like in DW but highly appended to the standard of the W3C-
and on the page you put a all the inputs with the form, and create a
batute-that is the function on KarinApp- and design the model of the
response, and with it you just call in some cases to a javascript
function named 'catcher' that will collect the data and send it to the
server. The server will run the batute-calling the libraries on KarinApp-
and the result will be sent to the client as HTML
element(s) and will be appended on the area that you want.

If you need more detailed information, please let me know.

On Mon, Dec 6, 2010 at 7:36 PM, Stef Mientki  wrote:

> On 04-12-2010 15:54, hid...@gmail.com wrote:
> > I am working on a tool that can create an application like that without
> write server code, but the
> > system is write in Python3.1
>
> very interesting, could you give us some more information about the project
>
> for the OP:
> with web2py, your site could be up within an hour.
>
> cheers,
> Stef
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sending XML to a WEB Service and Getting Response Back

2010-12-20 Thread Hidura
I recommend you use the urllib.request in the library of python says
everything that you want to know.

2010/12/20, Anurag Chourasia :
> Dear Python Mates,
>
> I have a requirement to send a XML Data to a WEB Service whose URL is of the
> form http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
>
> I also have to read back the response returned as a result of sending this
> data to this WebService.
>
> This web service implements the following operations:
>sendNCR
>
> This web service has no callbacks.
>
> I have pasted the complete WSDL for this WEB Service below my email.
>
> I would appreciate if someone could guide me with sample code using a Python
> Library suitable to fulfill this requirement of mine.
>
> Regards,
> Anurag
>
>
> 
> http://www.openuri.org/2002/04/soap/conversation/"; xmlns:cw="
> http://www.openuri.org/2002/04/wsdl/conversation/"; xmlns:http="
> http://schemas.xmlsoap.org/wsdl/http/"; xmlns:jms="
> http://www.openuri.org/2002/04/wsdl/jms/"; xmlns:mime="
> http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:s="
> http://www.w3.org/2001/XMLSchema"; xmlns:s0="http://www.openuri.org/";
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:soapenc="
> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="
> http://schemas.xmlsoap.org/wsdl/"; targetNamespace="http://www.openuri.org/";>
>   
> http://www.w3.org/2001/XMLSchema";
> elementFormDefault="qualified" targetNamespace="http://www.openuri.org/";>
>   
> 
>   
> 
>   
> 
>   
>   
> 
>   
> 
>   
> 
>   
>   
> 
>
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> 
>   
>   
> http://schemas.xmlsoap.org/soap/http";
> style="document"/>
> 
>   http://www.openuri.org/sendNCR";
> style="document"/>
>   
> 
>   
>   
> 
>   
> 
>   
>   
> 
> 
>   
>   
> 
>   
>   
> 
>   
> 
>   
>   
> 
> 
>   
>   
> 
>   
>   
> 
>   
> 
>   
>   
> 
>   http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
> 
> 
>   http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
> 
> 
>   http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
> 
>   
> 
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-22 Thread Hidura
I am creating one, is on test, what kind of app do you want create?

2010/12/22, Sean :
> Anybody know where I can find a Python Development Environment in the
> form of a web app for use with Chrome OS. I have been looking for a
> few days and all i have been able to find is some old discussions with
> python developers talking about they will want one for the OS to be a
> success with them.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-22 Thread Hidura
Why grashtly?

2010/12/22, Tim Harig :
> On 2010-12-22, Sean  wrote:
>> Anybody know where I can find a Python Development Environment in the
>> form of a web app for use with Chrome OS. I have been looking for a
>> few days and all i have been able to find is some old discussions with
>> python developers talking about they will want one for the OS to be a
>> success with them.
>
> Personally, I think a web app based IDE would be ghastly; but, you might
> have a look at Mozilla Skywriter (formerly Bespin):
>
> https://mozillalabs.com/skywriter/
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-22 Thread Hidura
Use editarea, that's the best option if you want something small, but
as i said before i am developing a framework that allows you to create
app's from the web and is much more complete than editarea.

2010/12/22, Sean :
> I am wanting to learn python and I am test a Chrome OS notebook at the
> same time so I need something that will atleast tell me if I have any
> syntax errors. Although the more features the better that way learning
> is an easier experience.
>
> On Dec 22, 7:05 pm, Hidura  wrote:
>> I am creating one, is on test, what kind of app do you want create?
>>
>> 2010/12/22, Sean :
>>
>> > Anybody know where I can find a Python Development Environment in the
>> > form of a web app for use with Chrome OS. I have been looking for a
>> > few days and all i have been able to find is some old discussions with
>> > python developers talking about they will want one for the OS to be a
>> > success with them.
>> > --
>> >http://mail.python.org/mailman/listinfo/python-list
>>
>> --
>> Enviado desde mi dispositivo móvil
>>
>> Diego I. Hidalgo D.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-22 Thread Hidura
My framework let you store online on a hosting server that the same
framework provide.

2010/12/22, Hidura :
> Use editarea, that's the best option if you want something small, but
> as i said before i am developing a framework that allows you to create
> app's from the web and is much more complete than editarea.
>
> 2010/12/22, Sean :
>> I am wanting to learn python and I am test a Chrome OS notebook at the
>> same time so I need something that will atleast tell me if I have any
>> syntax errors. Although the more features the better that way learning
>> is an easier experience.
>>
>> On Dec 22, 7:05 pm, Hidura  wrote:
>>> I am creating one, is on test, what kind of app do you want create?
>>>
>>> 2010/12/22, Sean :
>>>
>>> > Anybody know where I can find a Python Development Environment in the
>>> > form of a web app for use with Chrome OS. I have been looking for a
>>> > few days and all i have been able to find is some old discussions with
>>> > python developers talking about they will want one for the OS to be a
>>> > success with them.
>>> > --
>>> >http://mail.python.org/mailman/listinfo/python-list
>>>
>>> --
>>> Enviado desde mi dispositivo móvil
>>>
>>> Diego I. Hidalgo D.
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> --
> Enviado desde mi dispositivo móvil
>
> Diego I. Hidalgo D.
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web App

2010-12-22 Thread Hidura
Ok, but you are comparing a web-based framework with a native-based
framework that use the components of the system to make all the things
that need, a web-based framewok use the resourses of the browser to
make it all, so the developer that use a framework on the web can't
expect get the same results, in my case i beleive that a web-based
framework adjust better to the needs if you'll make a web-app,
otherwise use eclipse or netbeans.

2010/12/22, Tim Harig :
> [Reordered to preserve context in bottom posting]
> On 2010-12-23, Hidura  wrote:
>> 2010/12/22, Tim Harig :
>>> On 2010-12-22, Sean  wrote:
>>>> Anybody know where I can find a Python Development Environment in the
>>>> form of a web app for use with Chrome OS. I have been looking for a
>>>> few days and all i have been able to find is some old discussions with
>>>> python developers talking about they will want one for the OS to be a
>>>> success with them.
>>>
>>> Personally, I think a web app based IDE would be ghastly; but, you might
>>> have a look at Mozilla Skywriter (formerly Bespin):
>>
>> Why grashtly?
>
> I don't personally think the web makes a good framework for highly
> interactive applications as they must work within the constraints of the
> browser and IDEs are highly interactive applications by their very nature.
> Perhaps HTML5/CSS3 will change things; but, standard DOM manipulation,
> as I am accustomed to seeing it, cannot generate the kind of rendering
> that is available from native applications.  Attempts to do so end up being
> kludgy.
>
> It also cannot handle the kinds of desktop integrations that are common
> for native applications without opening up serious security trust issues.
> (Can everybody say ActiveX fiasco?)
>
> Finally, there are difficulties in handling keystrokes without conflicting
> with the browser's native key bindings.  I seldom ever touch a mouse
> and I am a huge fan of vi, mutt, slrn, screen, ratpoison, etc. where
> the primary interface is totally accessable through the keyboard without
> having to tab through many options.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Python Web App

2010-12-22 Thread hidura

Which is exactly the problem with web apps that are highly interactive. My
suggestion, is not to develope a web based IDE or use one. It just isn't
something that the web was designed to do well.


Is not a problem of the IDE, the problem is on what the developer expect
as i said i you want something to the desktop well use an IDE that creates
apps for desktop, but if you need something for the web you can try on a
web-based IDE.

Most IDEs that are targeted at web developement have a built in web  
browser
or strong integration with one to run the web app as you are developing  
it.
I don't see any advantage or the necessity of actually running the IDE  
code

itself in the browser.


That's the problem an integration with one, my IDE works on all of them and
the result is the same in IE and Chrome or FF, a web page cannot be designed
to one browser it has to be designed to all the browser and have to be  
same. On
the visualization is more difficult but nobody could control perfectly that  
but on

the results of the data is has to be the same.

I would; but then, I wouldn't purchase an operating system that is  
entirely

based on a web browser.


I support that, but the target of those OS are use the share resources of  
the pc,

smartphone, etc and the server.


On Dec 22, 2010 11:54pm, Tim Harig  wrote:

On 2010-12-23, Hidura hid...@gmail.com> wrote:



> Ok, but you are comparing a web-based framework with a native-based



> framework that use the components of the system to make all the things



> that need, a web-based framewok use the resourses of the browser to





Right. That is exactly what I am comparing.





> make it all, so the developer that use a framework on the web can't



> expect get the same results, in my case i beleive that a web-based





Which is exactly the problem with web apps that are highly interactive. My



suggestion, is not to develope a web based IDE or use one. It just isn't



something that the web was designed to do well.





> expect get the same results, in my case i beleive that a web-based



> framework adjust better to the needs if you'll make a web-app,




Most IDEs that are targeted at web developement have a built in web  
browser


or strong integration with one to run the web app as you are developing  
it.


I don't see any advantage or the necessity of actually running the IDE  
code



itself in the browser.





> otherwise use eclipse or netbeans.




I would; but then, I wouldn't purchase an operating system that is  
entirely



based on a web browser.



--



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


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


How to execute foreing code from Python

2011-01-23 Thread hidura
Hello i want to code from different languages using a Python script i know  
i can use os.system, but i don't know how to receive data or send arguments  
using that method if theres any another way to make it or there's a way to  
send arguments and receive data using os.system?


Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-23 Thread Hidura
Thanks to all for your fast responses. I will use this on a server
running on Linux, so there is no problem with the OS and probably i
will try to pipes and subprocess, but the pipes worry me because i
can't stop the process using timeout or i don't found how to stop
it...


2011/1/23, Dan Stromberg :
> On Sun, Jan 23, 2011 at 4:24 PM, Dave Angel  wrote:
>> On 01/-10/-28163 02:59 PM, hid...@gmail.com wrote:
>>>
>>> Hello i want to code from different languages using a Python script i
>>> know i can use os.system, but i don't know how to receive data or send
>>> arguments using that method if theres any another way to make it or
>>> there's a way to send arguments and receive data using os.system?
>>>
>>> Thanks in advance.
>>>
>>
>> That sentence runs on, and makes no sense to me.  But I can guess that you
>> would like to be able to write code in other languages, and call it from
>> within a Python script.
>
> Well, clearly it made some sense, or you wouldn't be responding.
>
>> If you're on Windows, and the other language is a compiled one like C,
>> compile it into a DLL, and call that DLL from Python.  Ctypes is the first
>> module to study.
>
> The DLL is but a weak mimicry of what *ix had for a long time before.
> On most *ix's, the .so is the analog to the windows DLL, though only
> AIX appears to suffer from the same kind of "DLL hell" that windows
> suffers from (which makes some historical if not technical sense,
> given that windows is related to OS/2, which like AIX is also from
> IBM).  Using a .so, you can still use ctypes.  You also have the
> option of using Cython, which is perhaps a bit better supported on
> *ix, but will likely now work on windows too.
>
>> If you're on Linux, and the code in the other language was written by
>> someone else, and is already compiled into an executable you cannot
>> change,
>
> This is rare on Linux - almost everything is changeable on Linux,
> because it is almost entirely opensource - sometimes entirely so,
> depending on distribution choice and what 3rd party apps you install
> after the OS install.
>
>> you probably should invoke it using the subprocess module.
>
> This is an option on almost any OS, and in fact is probably a pretty
> good one on almost any OS, even if you do have source.  Sadly, few
> windows programs are written to take advantage of this, perhaps
> because of the historical (dos/windows) command.com's fake pipes.
>
> You can communicate with a subprocess using pipes, or command line
> arguments, or files, or sockets, or shared memory.  There are probably
> other options that aren't coming to mind just now.  But usually, using
> pipes gives the loosest (best) coupling between processes.
>
> Microsoft appears to have recognized this to some extent by releasing
> powershell - though it uses object pipes rather than byte stream
> pipes.  Object pipes appear to require less serialization, but also
> appear to be less loosely coupled.  For remote pipes, powershell
> serializes to XML, while *ix pipes serialize exactly the same way
> remote local or remote.
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute foreing code from Python

2011-01-25 Thread Hidura
Hello, i understand how to execute a command on the terminal in linux, but
what i can't get it is the execution of programs and send the data as
arguments, the problem is that i can't execute the program and when i
execute the program give me an error with the stdin...

This is the code:

argPath = "test1"
args = open(argPath, 'w')

if self.extract.getByAttr(self.block, 'name', 'args') !=
None:

args.write(""+self.extract.getByAttr(self.block, 'name',
'args')[0].toxml()+"")
else:
        args.write('')

car = Popen(shlex.split('python3.1
/home/hidura/webapps/karinapp/Suite/ForeingCode/saveCSS.py', stdin=args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
args.close()

dataOut = car.stdout.read().decode()
log = car.stderr.read().decode()


if dataOut!='':
return dataOut.split('\n')

elif log != '':
return log.split('\n')[0]

else:
return None

And the code from the saveCSS.py

from xml.dom.minidom import parseString
import os
import sys

class savCSS:
"""This class has to save
the changes on the css file.
"""

def __init__(self, args):

document = parseString(args)
request = document.firstChild

address = request.getElementsByTagName('element')[0]
newdata = request.getElementsByTagName('element')[1]

cssfl =
open("/webapps/karinapp/Suite/"+address.getAttribute('value'), 'r')
cssData = cssfl.read()
cssfl.close()

dataCSS = ''
for child in newdata.childNodes:
if child.nodeType == 3:
dataCSS += child.nodeValue

nwcssDict = {}

for piece in dataCSS.split('}'):
nwcssDict[piece.split('{')[0]] = piece.split('{')[1]


cssDict = {}

for piece in cssData.split('}'):
cssDict[piece.split('{')[0]] = piece.split('{')[1]


for key in nwcssDict:
if key in cssDict == True:
del cssDict[key]

cssDict[key] = nwcssDict[key]


result = ''
for key in cssDict:
result += key+"{"+cssDict[key]+"}"


cssfl = open(cssfl.name, 'a')
cssfl.write(result)
cssfl.close()



if __name__ == "__main__":
print(sys.stdin)

savCSS(input)


On Sun, Jan 23, 2011 at 10:16 PM, Hidura  wrote:

> Thanks to all for your fast responses. I will use this on a server
> running on Linux, so there is no problem with the OS and probably i
> will try to pipes and subprocess, but the pipes worry me because i
> can't stop the process using timeout or i don't found how to stop
> it...
>
>
> 2011/1/23, Dan Stromberg :
> > On Sun, Jan 23, 2011 at 4:24 PM, Dave Angel  wrote:
> >> On 01/-10/-28163 02:59 PM, hid...@gmail.com wrote:
> >>>
> >>> Hello i want to code from different languages using a Python script i
> >>> know i can use os.system, but i don't know how to receive data or send
> >>> arguments using that method if theres any another way to make it or
> >>> there's a way to send arguments and receive data using os.system?
> >>>
> >>> Thanks in advance.
> >>>
> >>
> >> That sentence runs on, and makes no sense to me.  But I can guess that
> you
> >> would like to be able to write code in other languages, and call it from
> >> within a Python script.
> >
> > Well, clearly it made some sense, or you wouldn't be responding.
> >
> >> If you're on Windows, and the other language is a compiled one like C,
> >> compile it into a DLL, and call that DLL from Python.  Ctypes is the
> first
> >> module to study.
> >
> > The DLL is but a weak mimicry of what *ix had for a long time before.
> > On most *ix's, the .so is the analog to the windows DLL, though only
> > AIX appears to suffer from the same kind of "DLL hell" that windows
> > suffers from (which makes some historical if not technical sense,
> > given that windows is related to OS/2, which like AIX is also from
> > IBM).  Using a .so, you can still use ctypes.  You also have the
> > option of using Cython, whi

Problems receiving arguments on a subprocess

2011-01-26 Thread hidura
Hello i am trying to make a subprocess that will have to send data as an  
arguments and is executing the script but don't receiving anything.


Here is the code of the subprocess:
car = Popen(shlex.split(self.block.getAttribute('cmd')),  
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
data =  
car.communicate(str(""+self.extract.getByAttr(self.block, 'name', 'args')[0].toxml()+"").encode())




dataOut = data[0].decode()
log = data[1].decode()
print(dataOut)

if car.returncode < 1:
return dataOut.split('\n')

else:
print(log)
return log

Here is the code of the script:

"""
Created By: hidura
On Date: Jan 25, 2011
"""
from xml.dom.minidom import parseString
import os
import sys

class savCSS:
"""This class has to save
the changes on the css file.
"""

def __init__(self, args):

document = parseString(args)
request = document.firstChild

address = request.getElementsByTagName('element')[0]
newdata = request.getElementsByTagName('element')[1]

cssfl = open("/webapps/karinapp/Suite/"+address.getAttribute('value'), 'r')
cssData = cssfl.read()
cssfl.close()

dataCSS = ''
for child in newdata.childNodes:
if child.nodeType == 3:
dataCSS += child.nodeValue

nwcssDict = {}

for piece in dataCSS.split('}'):
nwcssDict[piece.split('{')[0]] = piece.split('{')[1]


cssDict = {}

for piece in cssData.split('}'):
cssDict[piece.split('{')[0]] = piece.split('{')[1]


for key in nwcssDict:
if key in cssDict == True:
del cssDict[key]

cssDict[key] = nwcssDict[key]


result = ''
for key in cssDict:
result += key+"{"+cssDict[key]+"}"


cssfl = open(cssfl.name, 'a')
cssfl.write(result)
cssfl.close()



if __name__ == "__main__":

print(sys.stdin.read())
savCSS(sys.stdin.read())


Thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problems receiving arguments on a subprocess

2011-01-26 Thread Hidura
The print line it doesn't print anything that's why i say is not
receiving anything.

2011/1/26, hid...@gmail.com :
> Hello i am trying to make a subprocess that will have to send data as an
> arguments and is executing the script but don't receiving anything.
>
> Here is the code of the subprocess:
> car = Popen(shlex.split(self.block.getAttribute('cmd')),
> stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> data =
> car.communicate(str(""+self.extract.getByAttr(self.block, 'name',
> 'args')[0].toxml()+"").encode())
>
>
>
> dataOut = data[0].decode()
> log = data[1].decode()
> print(dataOut)
>
> if car.returncode < 1:
> return dataOut.split('\n')
>
> else:
> print(log)
> return log
>
> Here is the code of the script:
>
> """
> Created By: hidura
> On Date: Jan 25, 2011
> """
> from xml.dom.minidom import parseString
> import os
> import sys
>
> class savCSS:
> """This class has to save
> the changes on the css file.
> """
>
> def __init__(self, args):
>
> document = parseString(args)
> request = document.firstChild
>
> address = request.getElementsByTagName('element')[0]
> newdata = request.getElementsByTagName('element')[1]
>
> cssfl = open("/webapps/karinapp/Suite/"+address.getAttribute('value'), 'r')
> cssData = cssfl.read()
> cssfl.close()
>
> dataCSS = ''
> for child in newdata.childNodes:
> if child.nodeType == 3:
> dataCSS += child.nodeValue
>
> nwcssDict = {}
>
> for piece in dataCSS.split('}'):
> nwcssDict[piece.split('{')[0]] = piece.split('{')[1]
>
>
> cssDict = {}
>
> for piece in cssData.split('}'):
> cssDict[piece.split('{')[0]] = piece.split('{')[1]
>
>
> for key in nwcssDict:
> if key in cssDict == True:
> del cssDict[key]
>
> cssDict[key] = nwcssDict[key]
>
>
> result = ''
> for key in cssDict:
> result += key+"{"+cssDict[key]+"}"
>
>
> cssfl = open(cssfl.name, 'a')
> cssfl.write(result)
> cssfl.close()
>
>
>
> if __name__ == "__main__":
>
> print(sys.stdin.read())
> savCSS(sys.stdin.read())
>
>
> Thanks in advance
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't use multiprocessing with class factory?

2011-01-28 Thread Hidura
What is the output?

2011/1/28, Alan :
> Can the below example be fixed to work?
> Thanks,
> Alan Isaac
>
> import multiprocessing as mp
>
> class Test(object):
> pass
>
> def class_factory(x):
> class ConcreteTest(Test):
> _x = x
> return ConcreteTest
>
> def f(cls):
> print cls._x
>
> if __name__ == '__main__':
> pool = mp.Pool(2)
> pool.map(f, [class_factory(i) for i in range(4)])
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to conserve the integrity of the string from a database response using Python

2011-02-17 Thread Hidura
Hello, i am using py-postgresql as the driver the database, when make a
select to a string with non-ASCII characters, the response replace the
character with "�" what can i make to change this to the correct character?

This is my code:

class decodify:

def __init__(self):
db = pgDriver.connect(user = 'demo', password='demo'
database='hidura_karinapp', host='localhost', port='5432')
d = db.prepare("""SELECT modules_reg.code FROM modules_reg,
domain_reg, sbdomain_reg, sbdomdl_asc where(modules_reg.id =
sbdomdl_asc.module AND modules_reg.mdname = 'police' AND sbdomain_reg.id =
sbdomdl_asc.domain AND sbdomain_reg.domain = domain_reg.id AND
domain_reg.dname = 'bmsuite.com' AND sbdomain_reg.sbname = 'www')""")
s = d()
print(s)

if __name__ == '__main__':
decodify()

-- 
Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Financial time series data

2010-09-02 Thread Hidura
But what kind of data you want to download?, because the financial
time it's basicly html code and you can work very well with a parser

2010/9/2, Virgil Stokes :
>   Has anyone written code or worked with Python software for downloading
> financial time series data (e.g. from Yahoo financial)? If yes,  would you
> please contact me.
>
> --Thanks,
> V. Stokes
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Financial time series data

2010-09-02 Thread hidura
I've tried to see the page and the code GSPC it's wrong i has used ^DJI,  
and when you download the page code use a xml parser localize the table  
element and read it. I can't access from the browser to the next page it  
doesn't appear as a link.

El , Virgil Stokes  escribió:

On 09/02/2010 08:15 PM, Hidura wrote:




But what kind of data you want to download?, because the financial



time it's basicly html code and you can work very well with a parser





2010/9/2, Virgil stoke...@it.uu.se>:






Has anyone written code or worked with Python software for downloading



financial time series data (eg from Yahoo financial)? If yes, would you



please contact me.





--Thanks,



V. Stokes



--



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










Here is a snippet of python code that I am trying to use for downloading  
financial data; but, I do not understand why it returns information from  
the second HTML page.





import urllib2



'''



I am trying to read each row of the table at:



http://finance.yahoo.com/q/cp?s=^GSPC



'''



ticker = []


url =  
urllib2.urlopen("http://download.finance.yahoo.com/d/quotes.csv...@%5egspc&f=sl1d1t1c1ohgv&e=.csv&h=PAGE".replace('PAGE',  
str(0)))



data = url.read()




Note, it does get all 50 rows of the first page; but, why does it also  
get the first row of the "next" HTML page?





--V








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


Re: How to make a web services in python ???

2010-09-17 Thread Hidura
What kind of web-service you have in mind

2010/9/17, Ariel :
> Hi everybody, I need some help to find documentation about how to implements
> web services in python, could you help me please ???
> Regards
> Thanks in advance
> Ariel
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Upload files with wsgi

2010-09-28 Thread Hidura
Hello, i have a project on Python3k, and i have a very big problem i
don' t find how take an upload file i am using the wsgiref lib, and or
theres any way to connect to the client in order to get the file by
myself?

Thank you
Diego Hidalgo.

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Upload files with wsgi

2010-09-28 Thread Hidura
I am trying to upload any type of file ext to an app written in Py3k,
using Apache+mod_wsgi i can't use django or cherryPy because i manage
the data in the request creating an xml to store the data from
selected areas and send it to the server. I am using the wsgiref
library to handle the request and the responses.

2010/9/28, John Nagle :
> On 9/28/2010 3:31 PM, Hidura wrote:
>> Hello, i have a project on Python3k, and i have a very big problem i
>> don' t find how take an upload file i am using the wsgiref lib, and or
>> theres any way to connect to the client in order to get the file by
>> myself?
>>
>> Thank you
>> Diego Hidalgo.
>
> This is not clear.
>
> Are you trying to upload a Python program to a server, where
> a web server will run it in response to web requests?  Or what?
>
> Does this involve an Apache server?
>
>   John Nagle
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Example or recomendation of a webserver

2010-09-28 Thread Hidura
I am working on a web project written on Py3k and using mod_wsgi on
the Apache that have to recibes the request client via a xml structure
and i am facing a lot of troubles with the upload files mainly because
i can' t see where they are, so i' ve decide to write my own web
server-django and the others doen' t work for my propouse-, what you
recomend me for start that?

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Re: Upload files with wsgi

2010-09-29 Thread hidura

That is what i get: FieldStorage(None, None, [])

On Sep 29, 2010 8:39am, hid...@gmail.com wrote:

Python3k give me an error doing that.



On Sep 29, 2010 3:55am, Richard Thomas chards...@gmail.com> wrote:
> On Sep 28, 11:31 pm, Hidura hid...@gmail.com> wrote:
>
> > Hello, i have a project on Python3k, and i have a very big problem i
>
> > don' t find how take an upload file i am using the wsgiref lib, and or
>
> > theres any way to connect to the client in order to get the file by
>
> > myself?
>
> >
>
> > Thank you
>
> > Diego Hidalgo.
>
> >
>
> > --
>
> > Enviado desde mi dispositivo móvil
>
> >
>
> > Diego I. Hidalgo D.
>
>
>
> 'wsgiref' doesn't do that part of request handling. You want to use
>
> the 'cgi' module to parse the POST data:  
http://docs.python.org/library/cgi.html

>
>
>
> Remember to set the enctype on your tags to multipart/form-
>
> data.
>
>
>
> Chard.
>
> --
>
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Example or recomendation of a webserver

2010-09-29 Thread Hidura
I use Python3.1, TurboGears, webOb, CherryPy and the others don' t work on
Python 3, please somebody recomend me a web framework for Python3.1 I AM
DESPERATE

On Wed, Sep 29, 2010 at 6:08 PM, Hidura  wrote:

> I use Python3.1, TurboGears, webOb, CherryPy and the others don' t work on
> Python 3, please somebody recomend me a web framework for Python3.1 I AM
> DESPERATE
>
> On Wed, Sep 29, 2010 at 6:45 AM, Diez B. Roggisch  wrote:
>
>> Hidura  writes:
>>
>> > I am working on a web project written on Py3k and using mod_wsgi on
>> > the Apache that have to recibes the request client via a xml structure
>> > and i am facing a lot of troubles with the upload files mainly because
>> > i can' t see where they are, so i' ve decide to write my own web
>> > server-django and the others doen' t work for my propouse-, what you
>> > recomend me for start that?
>>
>> not doing it. Reading the HTTP-RFC and the WSGI-PEP. And trying
>>
>>  print environ["wsgi.input"].read()
>>
>> inside your wsgi-script. Then, use webob to wrap the whole WSGI-stuff to
>> have at least a minimum of sensible abstraction.
>>
>> Or simply use Django or TurboGears2, follow the advices in their docs on
>> how to depoly them using mod_wsgi, and be happy.
>>
>> Diez
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
>
> --
> Diego I. Hidalgo D.
>



-- 
Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Problems with wsgi Python3

2010-09-30 Thread hidura
Hello list, i had seriously troubles with the connection between a form and  
the wsgi, i' ve made an application on Python3 and was running perfectly  
but when i try to use the  to pass the data this can't be see on the  
server, so what is your recommendation?, i am open to all the ideas less  
leave to Python2 i can't all the project was write on Python3, i was  
looking into the PEP 444 proposal too.


Here is the code what i used to take the data:

print(urllib.parse.parse_qs(environ['wsgi.input'].read(int(environ['CONTENT_LENGTH'])).decode()))

and here it's what the os.environ.item() prints to me:

('LESSOPEN', '|/usr/bin/lesspipe.sh %s')
('SSH_CLIENT', '190.94.122.180 38415 22')
('CVS_RSH', 'ssh')
('LOGNAME', 'hidura')
('INPUTRC', '/etc/inputrc')
('HOME', '/home/hidura')
('PATH', 
'/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin:/home/hidura/bin')
('LD_LIBRARY_PATH', '/home/hidura/webapps/karinapp/apache2/lib')
('LANG', 'en_US.UTF-8')
('TERM', 'xterm')
('SHELL', '/bin/bash')
('SHLVL', '3')
('G_BROKEN_FILENAMES', '1')
('HISTSIZE', '1000')
('_', '/home/hidura/webapps/karinapp/apache2/bin/httpd.worker')
('SSH_CONNECTION', '190.94.122.180 38415 174.121.79.178 22')
('SSH_TTY', '/dev/pts/5')
('HOSTNAME', 'web152.webfaction.com')
('PWD', '/home/hidura')
('MAIL', '/var/spool/mail/hidura')
('LS_COLORS', 
'no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:')
-110550484811701713451664404475--\r
Thanks, i am desperate.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura

Sorry, for the last mail, here it's what you asked:

{'CONTENT_LENGTH': '61',
[Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':
[Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;  
boundary=---8905735096173894531259794847',

[Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':
[Thu Sep 30 13:35:07 2010] [error] '/home/hidura/webapps/karinapp/Suite',
[Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':
[Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':
[Thu Sep 30 13:35:07 2010]  
[error] 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':
[Thu Sep 30 13:35:07 2010] [error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':
[Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':
[Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':
[Thu Sep 30 13:35:07 2010] [error] 'close',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':
[Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':
[Thu Sep 30 13:35:07 2010]  
[error] 'http://hidura.webfactional.com/?md=btdump',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_USER_AGENT':
[Thu Sep 30 13:35:07 2010] [error] 'Mozilla/5.0 (X11; U; Linux x86_64;  
en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_X_FORWARDED_FOR':
[Thu Sep 30 13:35:07 2010] [error] '190.94.122.180',
[Thu Sep 30 13:35:07 2010] [error] 'PATH_INFO':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'QUERY_STRING':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'REMOTE_ADDR':
[Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
[Thu Sep 30 13:35:07 2010] [error] 'REMOTE_PORT':
[Thu Sep 30 13:35:07 2010] [error] '58742',
[Thu Sep 30 13:35:07 2010] [error] 'REQUEST_METHOD':
[Thu Sep 30 13:35:07 2010] [error] 'POST',
[Thu Sep 30 13:35:07 2010] [error] 'REQUEST_URI':
[Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_FILENAME':
[Thu Sep 30 13:35:07 2010]  
[error] '/home/hidura/webapps/karinapp/Suite/Gate.py',

[Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_NAME':
[Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADDR':
[Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADMIN':
[Thu Sep 30 13:35:07 2010] [error] '[no address given]',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_NAME':
[Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_PORT':
[Thu Sep 30 13:35:07 2010] [error] '80',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_PROTOCOL':
[Thu Sep 30 13:35:07 2010] [error] 'HTTP/1.0',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_SIGNATURE':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_SOFTWARE':
[Thu Sep 30 13:35:07 2010] [error] 'Apache/2.2.15 (Unix) mod_wsgi/3.3  
Python/3.1',

[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.application_group':
[Thu Sep 30 13:35:07 2010] [error] 'web152.webfaction.com|/gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.callable_object':
[Thu Sep 30 13:35:07 2010] [error] 'application',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.handler_script':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.input_chunked':
[Thu Sep 30 13:35:07 2010] [error] '0',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_host':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_port':
[Thu Sep 30 13:35:07 2010] [error] '51543',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.process_group':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.request_handler':
[Thu Sep 30 13:35:07 2010] [error] 'wsgi-script',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.script_reloading':
[Thu Sep 30 13:35:07 2010] [error] '1',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.version':
[Thu Sep 30 13:35:

Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura

What mean this -743346150198628700241600224--\r?

On Sep 30, 2010 2:38pm, hid...@gmail.com wrote:

Sorry, for the last mail, here it's what you asked:



{'CONTENT_LENGTH': '61',
[Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':
[Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;  
boundary=---8905735096173894531259794847',

[Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':
[Thu Sep 30 13:35:07 2010] [error] '/home/hidura/webapps/karinapp/Suite',
[Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':
[Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':
[Thu Sep 30 13:35:07 2010]  
[error] 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':
[Thu Sep 30 13:35:07 2010] [error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':
[Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':
[Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':
[Thu Sep 30 13:35:07 2010] [error] 'close',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':
[Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
[Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':
[Thu Sep 30 13:35:07 2010]  
[error] 'http://hidura.webfactional.com/?md=btdump',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_USER_AGENT':
[Thu Sep 30 13:35:07 2010] [error] 'Mozilla/5.0 (X11; U; Linux x86_64;  
en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10',

[Thu Sep 30 13:35:07 2010] [error] 'HTTP_X_FORWARDED_FOR':
[Thu Sep 30 13:35:07 2010] [error] '190.94.122.180',
[Thu Sep 30 13:35:07 2010] [error] 'PATH_INFO':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'QUERY_STRING':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'REMOTE_ADDR':
[Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
[Thu Sep 30 13:35:07 2010] [error] 'REMOTE_PORT':
[Thu Sep 30 13:35:07 2010] [error] '58742',
[Thu Sep 30 13:35:07 2010] [error] 'REQUEST_METHOD':
[Thu Sep 30 13:35:07 2010] [error] 'POST',
[Thu Sep 30 13:35:07 2010] [error] 'REQUEST_URI':
[Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_FILENAME':
[Thu Sep 30 13:35:07 2010]  
[error] '/home/hidura/webapps/karinapp/Suite/Gate.py',

[Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_NAME':
[Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADDR':
[Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADMIN':
[Thu Sep 30 13:35:07 2010] [error] '[no address given]',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_NAME':
[Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_PORT':
[Thu Sep 30 13:35:07 2010] [error] '80',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_PROTOCOL':
[Thu Sep 30 13:35:07 2010] [error] 'HTTP/1.0',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_SIGNATURE':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'SERVER_SOFTWARE':
[Thu Sep 30 13:35:07 2010] [error] 'Apache/2.2.15 (Unix) mod_wsgi/3.3  
Python/3.1',

[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.application_group':
[Thu Sep 30 13:35:07 2010] [error] 'web152.webfaction.com|/gate.py',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.callable_object':
[Thu Sep 30 13:35:07 2010] [error] 'application',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.handler_script':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.input_chunked':
[Thu Sep 30 13:35:07 2010] [error] '0',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_host':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_port':
[Thu Sep 30 13:35:07 2010] [error] '51543',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.process_group':
[Thu Sep 30 13:35:07 2010] [error] '',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.request_handler':
[Thu Sep 30 13:35:07 2010] [error] 'wsgi-script',
[Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.script_reloadi

Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
I still receive nothing, here it's the code of the form maybe there it's  
the problem:


name="input" target="hidden-frm">







On Sep 30, 2010 4:55pm, "Diez B. Roggisch"  wrote:

Thomas Jollans tho...@jollybox.de> writes:




> On Thursday 30 September 2010, it occurred to hid...@gmail.com to  
exclaim:



>> What mean this



>> -743346150198628700241600224--\r?



>



> it looks like a MIME boundary. In this context most likely from a



> multipart/form-data transmission.





yep, as one can see in the headers below.





Additonally, it looks to me as if the form you are submitting is



empty. The content-length of just 61 matches barely the boundary.





Use something like





pdict = cgi.parse_header(environ["CONTENT_TYPE"])[1]



cgi.parse_multipart(environ["wsgi.input"], pdict)





to properly parse the request. But then of course actually upload



something.





Diez







>



>>



>> On Sep 30, 2010 2:38pm, hid...@gmail.com wrote:



>> > Sorry, for the last mail, here it's what you asked:



>> >



>> > {'CONTENT_LENGTH': '61',



>> > [Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':



>> > [Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;



>> > boundary=---8905735096173894531259794847',



>> > [Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':


>> > [Thu Sep 30 13:35:07 2010]  
[error] '/home/hidura/webapps/karinapp/Suite',



>> > [Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':



>> > [Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':



>> > [Thu Sep 30 13:35:07 2010]



>> > [error]


>> > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',  
[Thu



>> > Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':



>> > [Thu Sep 30 13:35:07 2010] [error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':



>> > [Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':



>> > [Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':



>> > [Thu Sep 30 13:35:07 2010] [error] 'close',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':



>> > [Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':



>> > [Thu Sep 30 13:35:07 2010]



>> > [error] 'http://hidura.webfactional.com/?md=btdump',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_USER_AGENT':


>> > [Thu Sep 30 13:35:07 2010] [error] 'Mozilla/5.0 (X11; U; Linux  
x86_64;


>> > en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid)  
Firefox/3.6.10',



>> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_X_FORWARDED_FOR':



>> > [Thu Sep 30 13:35:07 2010] [error] '190.94.122.180',



>> > [Thu Sep 30 13:35:07 2010] [error] 'PATH_INFO':



>> > [Thu Sep 30 13:35:07 2010] [error] '',



>> > [Thu Sep 30 13:35:07 2010] [error] 'QUERY_STRING':



>> > [Thu Sep 30 13:35:07 2010] [error] '',



>> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_ADDR':



>> > [Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',



>> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_PORT':



>> > [Thu Sep 30 13:35:07 2010] [error] '58742',



>> > [Thu Sep 30 13:35:07 2010] [error] 'REQUEST_METHOD':



>> > [Thu Sep 30 13:35:07 2010] [error] 'POST',



>> > [Thu Sep 30 13:35:07 2010] [error] 'REQUEST_URI':



>> > [Thu Sep 30 13:35:07 2010] [error] '/Gate.py',



>> > [Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_FILENAME':



>> > [Thu Sep 30 13:35:07 2010]



>> > [error] '/home/hidura/webapps/karinapp/Suite/Gate.py',



>> > [Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_NAME':



>> > [Thu Sep 30 13:35:07 2010] [error] '/Gate.py',



>> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADDR':



>> > [Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',



>> > [Thu Sep 30 13:35:07 2010

Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
Ppl, thankyou Diez and Thomas for your answers i did it, but it present me  
a problem with the solution what you give me Thomas this is the code:


ValueError: Invalid boundary in multipart form: ''

On Sep 30, 2010 6:16pm, hid...@gmail.com wrote:
I still receive nothing, here it's the code of the form maybe there it's  
the problem:










On Sep 30, 2010 4:55pm, "Diez B. Roggisch" de...@web.de> wrote:
> Thomas Jollans tho...@jollybox.de> writes:
>
>
>
> > On Thursday 30 September 2010, it occurred to hid...@gmail.com to  
exclaim:

>
> >> What mean this
>
> >> -743346150198628700241600224--\r?
>
> >
>
> > it looks like a MIME boundary. In this context most likely from a
>
> > multipart/form-data transmission.
>
>
>
> yep, as one can see in the headers below.
>
>
>
> Additonally, it looks to me as if the form you are submitting is
>
> empty. The content-length of just 61 matches barely the boundary.
>
>
>
> Use something like
>
>
>
> pdict = cgi.parse_header(environ["CONTENT_TYPE"])[1]
>
> cgi.parse_multipart(environ["wsgi.input"], pdict)
>
>
>
> to properly parse the request. But then of course actually upload
>
> something.
>
>
>
> Diez
>
>
>
>
>
> >
>
> >>
>
> >> On Sep 30, 2010 2:38pm, hid...@gmail.com wrote:
>
> >> > Sorry, for the last mail, here it's what you asked:
>
> >> >
>
> >> > {'CONTENT_LENGTH': '61',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;
>
> >> > boundary=---8905735096173894531259794847',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':
>
> >> > [Thu Sep 30 13:35:07 2010]  
[error] '/home/hidura/webapps/karinapp/Suite',

>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':
>
> >> > [Thu Sep 30 13:35:07 2010]
>
> >> > [error]
>
> >> > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',  
[Thu

>
> >> > Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':
>
> >> > [Thu Sep 30 13:35:07 2010]  
[error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',

>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'close',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':
>
> >> > [Thu Sep 30 13:35:07 2010]
>
> >> > [error] 'http://hidura.webfactional.com/?md=btdump',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_USER_AGENT':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'Mozilla/5.0 (X11; U; Linux  
x86_64;

>
> >> > en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid)  
Firefox/3.6.10',

>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_X_FORWARDED_FOR':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] '190.94.122.180',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'PATH_INFO':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] '',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'QUERY_STRING':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] '',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_ADDR':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_PORT':
>
> >> > [Thu Sep 30 13:35:07 2010] [error] '58742',
>
> >> > [Thu Sep 30 13:35:07 2010] [error] 'REQUEST_METHOD':
>
> >> > [Thu Sep 30 13:35:07 2010] [er

Re: Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
Now, i' m sure that the system it's uploading the file but still it's give  
me empty the information. I am considerating 2 crazy solutions what i want  
to share with you for listen your opinions:


1) Consist in translate to Python2.5 the area what receives the request and  
execute the area what begin the process with Python3.1 and wait to the  
other finish with the processing to read a file in where the other part  
write the result.
2) It's less crazy than the 1 and consist in strip the  
cpEnv["wsgi.input"].read() and take the information and begin the reading  
line by line in order to insert the information in the corresponding areas.


Waiting for your opinions and very happy with your help.

Diego Hidalgo.

On Sep 30, 2010 11:56pm, hid...@gmail.com wrote:
Ppl, thankyou Diez and Thomas for your answers i did it, but it present  
me a problem with the solution what you give me Thomas this is the code:



ValueError: Invalid boundary in multipart form: ''



On Sep 30, 2010 6:16pm, hid...@gmail.com wrote:
> I still receive nothing, here it's the code of the form maybe there  
it's the problem:

>
>
>
>
>
>
>
>
> On Sep 30, 2010 4:55pm, "Diez B. Roggisch" de...@web.de> wrote:
> > Thomas Jollans tho...@jollybox.de> writes:
> >
> >
> >
> > > On Thursday 30 September 2010, it occurred to hid...@gmail.com to  
exclaim:

> >
> > >> What mean this
> >
> > >> -743346150198628700241600224--\r?
> >
> > >
> >
> > > it looks like a MIME boundary. In this context most likely from a
> >
> > > multipart/form-data transmission.
> >
> >
> >
> > yep, as one can see in the headers below.
> >
> >
> >
> > Additonally, it looks to me as if the form you are submitting is
> >
> > empty. The content-length of just 61 matches barely the boundary.
> >
> >
> >
> > Use something like
> >
> >
> >
> > pdict = cgi.parse_header(environ["CONTENT_TYPE"])[1]
> >
> > cgi.parse_multipart(environ["wsgi.input"], pdict)
> >
> >
> >
> > to properly parse the request. But then of course actually upload
> >
> > something.
> >
> >
> >
> > Diez
> >
> >
> >
> >
> >
> > >
> >
> > >>
> >
> > >> On Sep 30, 2010 2:38pm, hid...@gmail.com wrote:
> >
> > >> > Sorry, for the last mail, here it's what you asked:
> >
> > >> >
> >
> > >> > {'CONTENT_LENGTH': '61',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;
> >
> > >> >  
boundary=---8905735096173894531259794847',

> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':
> >
> > >> > [Thu Sep 30 13:35:07 2010]  
[error] '/home/hidura/webapps/karinapp/Suite',

> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':
> >
> > >> > [Thu Sep 30 13:35:07 2010]
> >
> > >> > [error]
> >
> > >>  
> 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', [Thu

> >
> > >> > Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':
> >
> > >> > [Thu Sep 30 13:35:07 2010]  
[error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',

> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'close',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
> >
> > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':
> >
>

Problem saving uploaded files in Python3

2010-10-01 Thread hidura
Hello, i control the problem of the data what is uploaded by the POST  
method, in the web if the file is a text theres no problem
but the trouble comes when it's an enconded file as a Picture or other what  
the when the system insert the data into the file
well it doesn 't encoded in the write way i will put all the code, from the  
area whats take the environ['wsgi.input'] to the area

thats save the file:

tmpData = str(rawData)[1:].strip("' '")#Here the data from the  
environ['wsgi.input'], first i convert the byte into a string delete the  
first field that represent the b and after i strip the single quotes

dat = tmpData.split('\\r')#Then i split all the data in the '\\r'
s = open('/home/hidura/test.png', 'w')#I open the test.png file.
for cont in range(5,150):#Now beging in the 5th position to the 150th  
position

s.write(dat[cont])#Insert the piece of the data in the file.
s.close()#Then closed.

Where is the mistake?

Thankyou in advance.

--
Diego Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Problem saving uploaded files in Python3

2010-10-02 Thread hidura
The results was that, i can upload all the data normally comes as an byte  
code and looks like this:


\\n\\x1a\\n\\x00\\x00\\x00IHDR\\x00\\x00\\x05U\\x00\\x00\\x026\\x08\\x06\\x00\\x00\\x00P]h\\xc5\\x00\\x00\\x00\\x01sRGB\\x00\\xae\\xce\\x1c\\xe9\\x00\\x00\\x00\\x06bKGD\\x00\\xff\\x00\\xff\\x00\\xff\\xa0\\xbd\\xa7\\x93\\x00\\x00\\x00\\tpHYs\\x00\\x00\\x0b\\x13\\x00\\x00\\x0b\\x13\\x01\\x00\\x9a\\x9c\\x18\\x00\\x00\\x00\\x07tIME\\x07\\xda\\n\\x01\\x148\\x04\\x86\\xa0\\x99c\\x00\\x00\\x00\\x19tEXtComment\\x00Created  
with  
GIMPW\\x81\\x0e\\x17\\x00\\x00  
\\x00IDATx\\xda\\xec\\xddw\\x9cT\\xd5\\xf9\\xf8\\xf1\\xcf\\xbd\\xd3g{_v\\x97\\xde\\x9b]\\xb0!\\x8a\\x05\\x14\\xbbFE\\xe37\\xc6\\xfaK\\x8c\\x9a\\x18\\x13\\x13c\\x8b\\x1a\\x13Mb\\x8a\\xb1D,\\xb1\\x1b\\x0b\\x8aDbE\\xac\\x18D\\x94*(}y\\xb6\\xf7\\xd9\\xa9\\xf7\\x9e\\xf3\\xfbcf+\\xdb\\xc0u\\x97\\xe5y\\xbf^\\xe3\\xee\\xce\\xbd\\xa7\\xdcs\\xcf\\x1d\\x9d\\xc7s\\x0c\\x80\\xf7\\xbf\\xaa\\xd4e\\xf5ab\\xb6f\\x08\\xf1\\xdds9\\x0c\\xf2r\\xbd\\xec78\\x9d\\x14\\xafs\\x1ad\\x08!\\x84\\x10b\\x88\\x01\\xe0\\x99\\xa5\\xc5\\xd2\\x08b\\xf43j\\xd9h\\...@k\\xbe\\x89\\xa8\\x98\\x01`\\x18\\x18\\xa6\\x89i:\\xa4\\xc1\\x07\\x10\\'@f\\x92\\x9b\\xfd\\x06\\xa7\\xe1s\\xc9\\xcd\\x15\\xa2?\\x08\\xc5l\\xb6V\\x87x\\xeb\\x8b\\nfN\\xcc\\xc3\\xef\\x96gS\\x08!\\x84\\x10B\\x08!\\x84\\xe8K\\xca\\x8a\\xa1\\xeb\\xb7\\xa3\\xcb\\xd7\\xa0C\\xb5\\xa0\\x15\\x00\\xee\\xa4\\x0c\\xb0c}S\\x88a\\x827


and this is what i store in the file, and the part of the code what handle  
the wsgi it's that what i post, i am using to test the upload file area, i  
hope this is what you want



Thanks for the answer
On Oct 2, 2010 5:34am, "Diez B. Roggisch"  wrote:

Chris Rebert c...@rebertia.com> writes:





> On Fri, Oct 1, 2010 at 11:13 PM, hid...@gmail.com> wrote:



>> Hello, i control the problem of the data what is uploaded by the POST



>> method, in the web if the file is a text theres no problem


>> but the trouble comes when it's an enconded file as a Picture or other  
what



>> the when the system insert the data into the file


>> well it doesn 't encoded in the write way i will put all the code,  
from the



>> area whats take the environ['wsgi.input'] to the area



>> thats save the file:



>>



>> tmpData = str(rawData)[1:].strip("' '")#Here the data from the


>> environ['wsgi.input'], first i convert the byte into a string delete  
the



>> first field that represent the b and after i strip the single quotes



>> dat = tmpData.split('\\r')#Then i split all the data in the '\\r'



>> s = open('/home/hidura/test.png', 'w')#I open the test.png file.



>



>> Where is the mistake?





In believing that wsgi.input is a simple file that contains your



upload. It isn't. It is multipart/form-data encoded, to cope with



potentially many files being uploaded in one go, plus assorted other



form fields.





In another post, you have already been shown how to do this. What where



the results? How does your full script look like? How does the form look



like you upload with?





Diez



--



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


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


Re: WSGI by HTTP GET

2010-10-02 Thread Hidura
Be more specific but i recommend you, use a way in what you be very
explicit eg:part='bussiness' a bool for 3 options it's very diffcult
to handle.

2010/10/2, Niklasro :
> Hello
> Getting a web same page with 2 or more possible "states" eg business
> part, private part or all parts, can you recommend a way to represent
> the states via HTTP GET? Feasible way could be ?business=business, ?
> type=business, ?business=true or others. Should I minimize casting the
> variable? Which type should I reason, boolen or string? I now use
> seemingly arbitrary ?t=w to represent a state which technically works
> leaving a more readable and maintainable solution to wish.
> Thanks
> Niklas
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Re: Problem saving uploaded files in Python3

2010-10-04 Thread hidura

This is the code what i use to save the file.
tmpData = str(rawData)[1:].strip("' '")
tmp = tmpData.split('\\r')
for piece in tmp:
for slice in piece.split('\n'):
if 'Content-Disposition' in slice:
filename = slice.split(';')[2].split('=')[1]
h = open('home/hidura/'+filename.strip('" "'), 'wb')
elif '\\x' in slice:
pickle.dump(slice, h)
h.close()



On Oct 2, 2010 10:37am, hid...@gmail.com wrote:
The results was that, i can upload all the data normally comes as an byte  
code and looks like this:


\\n\\x1a\\n\\x00\\x00\\x00IHDR\\x00\\x00\\x05U\\x00\\x00\\x026\\x08\\x06\\x00\\x00\\x00P]h\\xc5\\x00\\x00\\x00\\x01sRGB\\x00\\xae\\xce\\x1c\\xe9\\x00\\x00\\x00\\x06bKGD\\x00\\xff\\x00\\xff\\x00\\xff\\xa0\\xbd\\xa7\\x93\\x00\\x00\\x00\\tpHYs\\x00\\x00\\x0b\\x13\\x00\\x00\\x0b\\x13\\x01\\x00\\x9a\\x9c\\x18\\x00\\x00\\x00\\x07tIME\\x07\\xda\\n\\x01\\x148\\x04\\x86\\xa0\\x99c\\x00\\x00\\x00\\x19tEXtComment\\x00Created  
with  
GIMPW\\x81\\x0e\\x17\\x00\\x00  
\\x00IDATx\\xda\\xec\\xddw\\x9cT\\xd5\\xf9\\xf8\\xf1\\xcf\\xbd\\xd3g{_v\\x97\\xde\\x9b]\\xb0!\\x8a\\x05\\x14\\xbbFE\\xe37\\xc6\\xfaK\\x8c\\x9a\\x18\\x13\\x13c\\x8b\\x1a\\x13Mb\\x8a\\xb1D,\\xb1\\x1b\\x0b\\x8aDbE\\xac\\x18D\\x94*(}y\\xb6\\xf7\\xd9\\xa9\\xf7\\x9e\\xf3\\xfbcf+\\xdb\\xc0u\\x97\\xe5y\\xbf^\\xe3\\xee\\xce\\xbd\\xa7\\xdcs\\xcf\\x1d\\x9d\\xc7s\\x0c\\x80\\xf7\\xbf\\xaa\\xd4e\\xf5ab\\xb6f\\x08\\xf1\\xdds9\\x0c\\xf2r\\xbd\\xec78\\x9d\\x14\\xafs\\x1ad\\x08!\\x84\\x10b\\x88\\x01\\xe0\\x99\\xa5\\xc5\\xd2\\x08b\\xf43j\\xd9h\\...@k\\xbe\\x89\\xa8\\x98\\x01`\\x18\\x18\\xa6\\x89i:\\xa4\\xc1\\x07\\x10\\'@f\\x92\\x9b\\xfd\\x06\\xa7\\xe1s\\xc9\\xcd\\x15\\xa2?\\x08\\xc5l\\xb6V\\x87x\\xeb\\x8b\\nfN\\xcc\\xc3\\xef\\x96gS\\x08!\\x84\\x10B\\x08!\\x84\\xe8K\\xca\\x8a\\xa1\\xeb\\xb7\\xa3\\xcb\\xd7\\xa0C\\xb5\\xa0\\x15\\x00\\xee\\xa4\\x0c\\xb0c}S\\x88a\\x827


and this is what i store in the file, and the part of the code what  
handle the wsgi it's that what i post, i am using to test the upload file  
area, i hope this is what you want




Thanks for the answer
On Oct 2, 2010 5:34am, "Diez B. Roggisch" de...@web.de> wrote:
> Chris Rebert c...@rebertia.com> writes:
>
>
>
> > On Fri, Oct 1, 2010 at 11:13 PM, hid...@gmail.com> wrote:
>
> >> Hello, i control the problem of the data what is uploaded by the POST
>
> >> method, in the web if the file is a text theres no problem
>
> >> but the trouble comes when it's an enconded file as a Picture or  
other what

>
> >> the when the system insert the data into the file
>
> >> well it doesn 't encoded in the write way i will put all the code,  
from the

>
> >> area whats take the environ['wsgi.input'] to the area
>
> >> thats save the file:
>
> >>
>
> >> tmpData = str(rawData)[1:].strip("' '")#Here the data from the
>
> >> environ['wsgi.input'], first i convert the byte into a string delete  
the

>
> >> first field that represent the b and after i strip the single quotes
>
> >> dat = tmpData.split('\\r')#Then i split all the data in the '\\r'
>
> >> s = open('/home/hidura/test.png', 'w')#I open the test.png file.
>
> >
>
> >> Where is the mistake?
>
>
>
> In believing that wsgi.input is a simple file that contains your
>
> upload. It isn't. It is multipart/form-data encoded, to cope with
>
> potentially many files being uploaded in one go, plus assorted other
>
> form fields.
>
>
>
> In another post, you have already been shown how to do this. What where
>
> the results? How does your full script look like? How does the form look
>
> like you upload with?
>
>
>
> Diez
>
> --
>
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


How to save a binary file?

2010-10-05 Thread hidura
Hello, how i can save a binary file, i read in the manual in the IO area  
but doesn' t show how to save it.

Here is the code what i am using:
s = open('/home/hidura/test.jpeg', 'wb')
s.write(str.encode(formFields[5]))
s.close()

If needs the binary code i could upload.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Re: How to save a binary file?

2010-10-05 Thread hidura
\\x17\\x19\\xa7\\x7f\\xe6\\r9\\x99wC)\\n\\x0eMe^Ec\\xf1\\x7f*P\\xd0\\x01\\x8fV\\xea_\\x86!\\xf9\\x19\\xa6}gM\\xceD2azzj;\\xeb\\x90\\xb3\\xe1K\\xf9}\\x81^\\xf5C\\x98\\xff\\x00Uq\\xf2\\xb1\\xf1\\x1f\\xda\\x8f\\xc3\\x10\\xe6\\xcd<^!\\xb5x\\xdd\\xdc+\\xb9\\xe3\\x18\\xedu\\xb7\\xb3\\x19dywj#\\...@\\xaa\\x82\\x90\\xb8\\xdc\\x92\\x10o\\x1c\\xd4\\xf3"Ml\\x8ad\\xd8\\x83\\xbf\\xbe)x\\x04\\xf0}\\xe9\\x8c\\xaa#\\xe1\\xb9\\xa7\\xc1\\t\\xb2b\\xde\\xdc\\tK\\xf9\\xccI\\x1f\\x11\\xff\\x00*T\\xd4&\\xc9*X\\xb1\\xaa\\xd203\\x9c\\xe3\\xb5:\\xdc\\xbc\\x8cUFI\\xe0\\x0fj8"y2\\xc9on\\x11B\\xb2\\xe3vrH\\xebR\\xb4+\\xa7Y| 
\\xa34\\x8d\\x19\\x19\\xda\\xc7\\x80y\\xe9Qn\\x92#\\x12\\x01:\\xf4\\xc2\\x92\\xbc\\xb9\\xefP\\xf7\\xb4R\\x12y`\\xdcT\\xf1\\xe4\\x8dT\\xb8\\xc9Y\\xab\\x92\\xe8.U\\xc3\\x90;\\x0e\\x95\\x13vf\\xe2\\xc7=\\xfeu\\x12\\xd6\\xf9f\\x1e[7\\xaf\\xb0\\x...@b\\x87\\x81\\xfcz\\xd3=^x\\xa6\\xb9@#H\\xe1\\x01V\\xa1Hw!\\xe3;\\xba\\xd2(\\n\\t\\x0c1\\xd2\\x93\\xa8#p\\xfd\\xe8\\'\\x8a\\xfd\\x11d\\xb6\\x00\\x10\\xad\\x82*4\\x9b\\xd7*\\xcf\\'\\xfe\\xfe?\\x95X\\xb8}\\xbb\\xb7\\x90OLt\\xa7B\\xab\\x86\\r\\xb1\\x89\\xf7\\xad\\x14\\xff\\x00f2\\xc0\\x9fEX3$\\x7f\\x87#\\xe0\\xf5\\xf5RF\\xfe\\x9fS1e\\xe7\\x19\\xa9\\xd2Z\\x0cd6\\xd1\\xfd*\\x1d\\xc5\\xa3\\x9c\\x95`\\xd8\\x1d\\xaa\\xe3(\\xb3\\tb\\x94\\x0e{\\xd9\\xcb+4\\xa7  
q\\xf2\\xa9\\x7f\\xdb\\x1a\\x9e\\xc5\\xc5\\xe6\\xd5^\\xdbj\\xb1\\xd4\\xa8U`\\xdd=\\xa9\\x99;Cs\\x83W\\xc536i\\x17\\xc4\\x97Ev\\xcfo\\x14\\x98\\xee\\x87\\x04\\xd1_\\xc4L\\xcb\\xff\\x00\\xa6e\\xfd\\xeb2\\x8f\\x91\\xf4\\xa7\\xc8\\xfe\\x8fz\\x9f\\xc7\\x16"\\xe2}ni\\x...@\\x07\\xb1\\xebc\\x17\\xf2\\r\\xb9m\\xc0\\x1e\\x95v\\xb3a\\xf7*\\xe7+n\\xf37r\\xa3\\x1e\\xe2\\x8e\\t\\x16\\xa4x\\rbr\\x14\\xa9\\xf2\\xcf;\\xbf\\x9d\\x10k\\x12"\\xe0\\xaa\\xba\\xf6\\xcfJ\\xac\\x0cs\\xc8\\xe2\\xb9\\xdc2\\x9f\\x95\\x1cP\\x9b,\\xdbZ\\xdc\\xfe\\x88\\x98+p\\xca{})\\xd1j\\xd1\\xa0*\\xc9  
A\\xd0g\\x8a\\xa2\\t\\xb8\\x9c\\xd3\\xc3\\x1c`\\x1c\\x8a\\x10\\x8b\\xcf\\xed\\xbfHHm\\x89\\x03\\xf5\\xff\\x00\\xa56M^\\xe8\\xf4\\x8e%n\\xfc\\xe4\\xd5!c\\x8e)C\\x96\\x1c\\xb7J\\xaf\\xc7\\x10\\xb4\\x8bY\\xb5\\x9b\\xd6  
\\x89Uq\\xfc5\\x1eMV\\xe8\\xa7\\xaa`\\xfb\\xbb\\x85\\xe9P\\x0bo8\\xc6~t\\xc78\\x02\\x9a\\x84D\\xd92+\\xc9Y\\xf6\\xc8\\xecs\\xf2\\xc5J\\x88\\xe6<1%\\x83~\\xaa\\xa7\\xdf\\xb4\\xe4U\\x84R\\x1d\\xa0\\xe3\\xb5L\\xd24\\xc5?E\\x92\\xc8\\xb1\\xacj\\xf8\\xe7\\xf5QM\\xcc\\xfbH\\x12\\x9d\\xb9\\xe3\\x9c\\xd5p\\x93$\\x10:\\nT\\x9c\\x83\\xcde\\xc4\\xe9N/\\xb2\\xc8^\\xdd\\xaac\\xcd\\x1b~\\x94xoG\\x96\\x0b\\xc6\\xac\\xde\\xf5V%\\xc8\\xfa\\xd1a\\x93\\x03?\\xb5KCQ\\x83-~\\xf56\\xd5p\\xca\\xa0t\\x06\\x99%\\xdc\\xa5G\\xe2\\x0c\\xfc\\xaa30)\\xc5\\x05\\xbd%p\\xbe\\xfc\\xd6T\\xce\\xaf\\xc7\\x8d-"JL\\xa4\\xe2\\xe1\\xc6{\\x06\\xa43\\xca\\x00+!=\\x89&\\xa2\\xab\\xb3\\x11\\x83\\x8aU\\x90\\xf4#&\\x9e\\xc3\\x8c?D\\x89\\x1eBC\\x17\\xe7\\xe5B


Sorry for the last send.

On Oct 5, 2010 6:18pm, "Jonas H." jo...@lophus.org> wrote:
> On 10/05/2010 11:11 PM, hid...@gmail.com wrote:
>
>
> Hello, how i can save a binary file, i read in the manual in the IO area
>
> but doesn' t show how to save it.
>
> Here is the code what i am using:
>
> s = open('/home/hidura/test.jpeg', 'wb')
>
> s.write(str.encode(formFields[5]))
>
> s.close()
>
>
>
>
> So where's the problem? That code should work. Anyway, you want to have  
a look at with-statements.

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


Re: Re: How to save a binary file?

2010-10-05 Thread hidura

I has to use repr to convert in this string: ÿØÿà\x00\x10JFIF?

On Oct 5, 2010 8:03pm, MRAB  wrote:

On 05/10/2010 23:50, hid...@gmail.com wrote:




I did but the mistake is: Error interpreting JPEG image file (Not a JPEG



file: starts with 0x5c 0x6e)



I think the problem is maybe in the binary code here is:



[snip]





Sorry for the last send.



> On Oct 5, 2010 6:18pm, "Jonas H." jo...@lophus.org> wrote:



> > On 10/05/2010 11:11 PM, hid...@gmail.com wrote:



> >



> >



> > Hello, how i can save a binary file, i read in the manual in the IO



area



> >



> > but doesn' t show how to save it.



> >



> > Here is the code what i am using:



> >



> > s = open('/home/hidura/test.jpeg', 'wb')



> >



> > s.write(str.encode(formFields[5]))



> >



> > s.close()



> >



> >



> >



> >



> > So where's the problem? That code should work. Anyway, you want to



have a look at with-statements.



> >




Why are you encoding it? A JPEG file should contain the binary data,



not a textual encoding of its bytes. The error message you got said



that the contents of the file started with a backslash.





If you print out, say, repr(str[ : 10]) you should get something like



'ÿØÿà\x00\x10JFIF'.





Try this instead:





s = open('/home/hidura/test.jpeg', 'wb')



s.write(str)



s.close()





Incidentally, 'str' is a bad name for a variable because it's the name



of the built-in string type.



--



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


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


Re: Re: Re: How to save a binary file?

2010-10-06 Thread hidura
When you put the 'wb' extension you have to pass a Encode the string Python  
does not accept a string on a wb file, Python3


On Oct 6, 2010 1:01am, Chris Rebert  wrote:

> On Oct 5, 2010 8:03pm, MRAB pyt...@mrabarnett.plus.com> wrote:



>> On 05/10/2010 23:50, hid...@gmail.com wrote:


>> I did but the mistake is: Error interpreting JPEG image file (Not a  
JPEG



>> file: starts with 0x5c 0x6e)



>>



>> I think the problem is maybe in the binary code here is:





>> > On Oct 5, 2010 6:18pm, "Jonas H." jo...@lophus.org> wrote:



>> > > On 10/05/2010 11:11 PM, hid...@gmail.com wrote:



>> > > Hello, how i can save a binary file, i read in the manual in the IO



>> area



>> > > but doesn' t show how to save it.



>>



>> > > Here is the code what i am using:



>> > > s = open('/home/hidura/test.jpeg', 'wb')



>> > > s.write(str.encode(formFields[5]))



>> > > s.close()





>> Why are you encoding it? A JPEG file should contain the binary data,



>> not a textual encoding of its bytes. The error message you got said



>> that the contents of the file started with a backslash.



>>



>> If you print out, say, repr(str[ : 10]) you should get something like



>>



>> 'ÿØÿà\x00\x10JFIF'.



>>



>> Try this instead:



>>



>> s = open('/home/hidura/test.jpeg', 'wb')



>> s.write(str)



>> s.close()



>>



>> Incidentally, 'str' is a bad name for a variable because it's the name



>> of the built-in string type.





On Tue, Oct 5, 2010 at 9:53 PM, hid...@gmail.com> wrote:



> I has to use repr to convert in this string: ÿØÿà\x00\x10JFIF?





No, you don't/shouldn't convert it at all. Read/use the 3 lines of



suggested code that MRAB gave:



s = open('/home/hidura/test.jpeg', 'wb')



s.write(str)



s.close()





Cheers,



Chris


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


Re: Re: Re: Re: How to save a binary file?

2010-10-06 Thread hidura
How i get the code what MRAB says theres any manual or example?, because i  
was trying in Python2.x to do it and give me the same mistake, when i try  
to use repr that give me more backslash


On Oct 6, 2010 10:25am, hid...@gmail.com wrote:
When you put the 'wb' extension you have to pass a Encode the string  
Python does not accept a string on a wb file, Python3



On Oct 6, 2010 1:01am, Chris Rebert c...@rebertia.com> wrote:
> > On Oct 5, 2010 8:03pm, MRAB pyt...@mrabarnett.plus.com> wrote:
>
> >> On 05/10/2010 23:50, hid...@gmail.com wrote:
>
> >> I did but the mistake is: Error interpreting JPEG image file (Not a  
JPEG

>
> >> file: starts with 0x5c 0x6e)
>
> >>
>
> >> I think the problem is maybe in the binary code here is:
>
>
>
> >> > On Oct 5, 2010 6:18pm, "Jonas H." jo...@lophus.org> wrote:
>
> >> > > On 10/05/2010 11:11 PM, hid...@gmail.com wrote:
>
> >> > > Hello, how i can save a binary file, i read in the manual in the  
IO

>
> >> area
>
> >> > > but doesn' t show how to save it.
>
> >>
>
> >> > > Here is the code what i am using:
>
> >> > > s = open('/home/hidura/test.jpeg', 'wb')
>
> >> > > s.write(str.encode(formFields[5]))
>
> >> > > s.close()
>
>
>
> >> Why are you encoding it? A JPEG file should contain the binary data,
>
> >> not a textual encoding of its bytes. The error message you got said
>
> >> that the contents of the file started with a backslash.
>
> >>
>
> >> If you print out, say, repr(str[ : 10]) you should get something like
>
> >>
>
> >> 'ÿØÿà\x00\x10JFIF'.
>
> >>
>
> >> Try this instead:
>
> >>
>
> >> s = open('/home/hidura/test.jpeg', 'wb')
>
> >> s.write(str)
>
> >> s.close()
>
> >>
>
> >> Incidentally, 'str' is a bad name for a variable because it's the  
name

>
> >> of the built-in string type.
>
>
>
> On Tue, Oct 5, 2010 at 9:53 PM, hid...@gmail.com> wrote:
>
> > I has to use repr to convert in this string: ÿØÿà\x00\x10JFIF?
>
>
>
> No, you don't/shouldn't convert it at all. Read/use the 3 lines of
>
> suggested code that MRAB gave:
>
> s = open('/home/hidura/test.jpeg', 'wb')
>
> s.write(str)
>
> s.close()
>
>
>
> Cheers,
>
> Chris
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: How to save a binary file?

2010-10-06 Thread hidura
Ppl thanyou, for all your help finally i did it! thanks, another thing  
to i have to send a propouse code, i can fixed the litle problem of the  
wsig.input in Python 3 i will tested in the next months but i want to share  
the code with the comunnity, how i can do that?


On Oct 6, 2010 1:45pm, MRAB  wrote:

On 06/10/2010 15:25, hid...@gmail.com wrote:




When you put the 'wb' extension you have to pass a Encode the string



Python does not accept a string on a wb file, Python3






[snip]



You are using Python 3 and type(str) returns ""?





Binary data in Python 3 should be an instance of the 'bytes' class, not



an instance of the 'str' class.





If you can't fix that, you could turn the string into bytes using:





data = bytes(ord(c) for c in str)





or by carefully choosing an encoding which would give the same result:





data = str.encode('latin-1')





Then you can save it:





s = open('/home/hidura/test.jpeg', 'wb')



s.write(data)



s.close()





I asked you to look at the result of repr so that you could see more



clearly what the data actually looked like, an instance of str or an



instance of bytes.



--



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


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


Re: Re: Re: How to save a binary file?

2010-10-06 Thread hidura
Ppl thanyou, for all your help finally i did it! thanks, another thing  
to who i can send a propose code, i fixed the little problem of the  
wsig.input in Python 3 i will tested in the next months but i want to share  
the code with the community, how i can do that?


On Oct 6, 2010 3:13pm, hid...@gmail.com wrote:
Ppl thanyou, for all your help finally i did it! thanks, another  
thing to i have to send a propouse code, i can fixed the litle problem of  
the wsig.input in Python 3 i will tested in the next months but i want to  
share the code with the comunnity, how i can do that?



On Oct 6, 2010 1:45pm, MRAB pyt...@mrabarnett.plus.com> wrote:
> On 06/10/2010 15:25, hid...@gmail.com wrote:
>
>
> When you put the 'wb' extension you have to pass a Encode the string
>
> Python does not accept a string on a wb file, Python3
>
>
>
>
> [snip]
>
> You are using Python 3 and type(str) returns ""?
>
>
>
> Binary data in Python 3 should be an instance of the 'bytes' class, not
>
> an instance of the 'str' class.
>
>
>
> If you can't fix that, you could turn the string into bytes using:
>
>
>
> data = bytes(ord(c) for c in str)
>
>
>
> or by carefully choosing an encoding which would give the same result:
>
>
>
> data = str.encode('latin-1')
>
>
>
> Then you can save it:
>
>
>
> s = open('/home/hidura/test.jpeg', 'wb')
>
> s.write(data)
>
> s.close()
>
>
>
> I asked you to look at the result of repr so that you could see more
>
> clearly what the data actually looked like, an instance of str or an
>
> instance of bytes.
>
> --
>
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: [Web-SIG] Propouse code

2010-10-09 Thread hidura
What type of codec is the best to encode binary files what are upload to an  
app write in Python 3?


On Oct 7, 2010 1:44pm, Tres Seaver  wrote:

-BEGIN PGP SIGNED MESSAGE-



Hash: SHA1





On 10/07/2010 12:17 PM, hid...@gmail.com



wrote:




> Hello list, i am develop an web app in Python 3 and i was faced the  
problem


> of the wsgi.input, at the first i follow all the manuals and always  
give me



> an error but after i create my own code, and with all the modest of the



> world i want to know how i can share with the python community when i



> finish the test?





I suggest the following:





- - Host the code's repository on the DVCS-friendly server of your choice



(bitbucket, github, launchpad). You might even post the link to the



repository to this list before you are ready for a formal release:



some brave souls might try it out, and give you patches or comments.





- - Manage your application libraries as a distitis project (eg,



installable via 'python setup.py install').





- - Ideally, use either 'setuptools' or 'distirbute' extensions to



the distutils, which will make releasing the code to the Python



Package Index as easy as; 'python setup.py sdist register upload'.





- - Announce your release(s) on this list.







Trse.



- --



===



Tres Seaver +1 540-429-0999 tsea...@palladion.com



Palladion Software "Excellence by Design" http://palladion.com



-BEGIN PGP SIGNATURE-



Version: GnuPG v1.4.10 (GNU/Linux)



Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/





iEYEARECAAYFAkyuBuUACgkQ+gerLs4ltQ43nwCfbNkVEhxbpJ3xKwmuosLaIUpg



JxMAn2SfnXhoJuhZQEVikCz1FaAEKNXJ



=ZNeA



-END PGP SIGNATURE-





___



Web-SIG mailing list



web-...@python.org



Web SIG: http://www.python.org/sigs/web-sig


Unsubscribe:  
http://mail.python.org/mailman/options/web-sig/hidura%40gmail.com


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


Re: Re: unicode problem?

2010-10-09 Thread hidura
I had a similar problem but i can 't encode a byte to a file what has been  
uploaded, without damage the data if i used utf-8 to encode the file  
duplicates the size, and i try to change the codec to raw_unicode_escape  
and this barely give me the correct size but still damage the file, i used  
Python 3 and i have to encode the file again.


On Oct 9, 2010 11:39pm, Chris Rebert  wrote:

On Sat, Oct 9, 2010 at 4:59 PM, Brian Blais bbl...@bryant.edu> wrote:


> This may be a stemming from my complete ignorance of unicode, but when  
I do this (Python 2.6):



>



> s='\xc2\xa9 2008 \r\n'



>


> and I want the ascii version of it, ignoring any non-ascii chars, I  
thought I could do:



>



> s.encode('ascii','ignore')



>



> but it gives the error:



>



> In [20]:s.encode('ascii','ignore')


>  




> UnicodeDecodeError Traceback (most recent call last)



>



> /Users/bblais/python/doit100810a.py in ()



> > 1



> 2



> 3



> 4



> 5



>


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



>



> am I doing something stupid here?





In addition to Benjamin's explanation:





Unicode strings in Python are of type `unicode` and written with a



leading "u"; eg u"A unicode string for ¥500". Byte strings lack the



leading "u"; eg "A plain byte string". Note that "Unicode string"



does not refer to strings which have been encoded using a Unicode



encoding (eg UTF-8); such strings are still byte strings, for



encodings emit bytes.





As to why you got the /exact/ error you did:



As a backward compatibility hack, in order to satisfy your nonsensical



encoding request, Python implicitly tried to decode the byte string



`s` using ASCII as a default (the choice of ASCII here has nothing to



do with the fact that you specified ASCII in your encoding request),



so that it could then try and encode the resulting unicode string;



hence why you got a Unicode*De*codeError as opposed to a



Unicode*En*codeError, despite the fact you called *en*code().





Highly suggested further reading:



"The Absolute Minimum Every Software Developer Absolutely, Positively



Must Know About Unicode and Character Sets (No Excuses!)"



http://www.joelonsoftware.com/articles/Unicode.html





Cheers,



Chris



--



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


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


Re: Re: Re: Re: How to save a binary file?

2010-10-09 Thread hidura
Finally i had problems to save the files what are encoded i can't encode  
the string to save the file, any ideas?


On Oct 6, 2010 3:15pm, hid...@gmail.com wrote:
Ppl thanyou, for all your help finally i did it! thanks, another  
thing to who i can send a propose code, i fixed the little problem of the  
wsig.input in Python 3 i will tested in the next months but i want to  
share the code with the community, how i can do that?



On Oct 6, 2010 3:13pm, hid...@gmail.com wrote:
> Ppl thanyou, for all your help finally i did it! thanks, another  
thing to i have to send a propouse code, i can fixed the litle problem of  
the wsig.input in Python 3 i will tested in the next months but i want to  
share the code with the comunnity, how i can do that?

>
> On Oct 6, 2010 1:45pm, MRAB pyt...@mrabarnett.plus.com> wrote:
> > On 06/10/2010 15:25, hid...@gmail.com wrote:
> >
> >
> > When you put the 'wb' extension you have to pass a Encode the string
> >
> > Python does not accept a string on a wb file, Python3
> >
> >
> >
> >
> > [snip]
> >
> > You are using Python 3 and type(str) returns ""?
> >
> >
> >
> > Binary data in Python 3 should be an instance of the 'bytes' class,  
not

> >
> > an instance of the 'str' class.
> >
> >
> >
> > If you can't fix that, you could turn the string into bytes using:
> >
> >
> >
> > data = bytes(ord(c) for c in str)
> >
> >
> >
> > or by carefully choosing an encoding which would give the same result:
> >
> >
> >
> > data = str.encode('latin-1')
> >
> >
> >
> > Then you can save it:
> >
> >
> >
> > s = open('/home/hidura/test.jpeg', 'wb')
> >
> > s.write(data)
> >
> > s.close()
> >
> >
> >
> > I asked you to look at the result of repr so that you could see more
> >
> > clearly what the data actually looked like, an instance of str or an
> >
> > instance of bytes.
> >
> > --
> >
> > http://mail.python.org/mailman/listinfo/python-list
> >
-- 
http://mail.python.org/mailman/listinfo/python-list


UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread hidura
Hello everybody i am trying to encode a file string of an upload file and i  
am facing some problems with the first part of the file. When i open  
directly and try to decode the file the error is this:  
`UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0:  
unexpected code byte` here is the first part of the file:

`\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c`
but when i try to encode the file in the server the encode change the parts  
of the file and the result is  
this:`\xc3\xbf\xc3\x98\xc3\xbf\xc3\xa0\x00\x10JFIF` without say that the  
file doesn 't save correctly.


Any ideas?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread Hidura
I try to encode a binary file what was upload to a server and is
extract from the wsgi.input of the environ and comes as an unicode
string.

2010/10/10, Almar Klein :
> Hi,
>
> please tell us what you are trying to do. Encoding (with UTF-8) is a method
> to convert a Unicode string to a sequence of bytes. Decoding does the
> reverse.
>
>
> When i open
>> directly and try to decode the file the error is this:
>> `UnicodeDecodeError:
>> 'utf8' codec can't decode byte 0xff in position 0: unexpected code byte`
>>
>
> This means the series of byte that you are trying to convert to a string is
> not valid UTF-8. It can't be, because it would not contain 0xff or 0xfe
> bytes.
>
>
> but when i try to encode the file in the server the encode change the parts
>> of the file and the result is
>> this:`\xc3\xbf\xc3\x98\xc3\xbf\xc3\xa0\x00\x10JFIF` without say that the
>>
>
> So here you *encode* the file, not decoding it.
>
>   Almar
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UTF-8 problem encoding and decoding in Python3

2010-10-12 Thread Hidura
Don't work this is the error what give me TypeError: sequence item 0:
expected bytes, str found, i continue trying to figure out how resolve it if
you have another idea please tellme, but thanks anyway!!!

On Mon, Oct 11, 2010 at 4:27 AM, Almar Klein  wrote:

>
> On 10 October 2010 23:01, Hidura  wrote:
>
>> I try to encode a binary file what was upload to a server and is
>> extract from the wsgi.input of the environ and comes as an unicode
>> string.
>>
>
> Firstly, UTF-8 is not meant to encode arbitrary binary data. But I guess
> you could have a Unicode string in which the character index represents a
> byte number. (But it's ugly!)
>
> So if you can, you could make sure to send the file as just bytes, or if it
> must be a string, base64 encoded. If this is not possible you can try the
> code below to obtain the bytes, not a very fast solution, but it should work
> (Python 3):
>
>
> MAP = {}
> for i in range(256):
> MAP[tmp] = eval("'\\u%04i'" % i)
>
> # Let's say 'a' is your string
> b''.join([MAP[c] for c in a])
>
>
> Cheers,
>   Almar
>



-- 
Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Re: UTF-8 problem encoding and decoding in Python3

2010-10-14 Thread hidura
Finally did it, thank you all for your help, the code i will upload because  
can be used by Python 3 for handle the wsgi issue of the Bytes!

Almar, sorry for the mails gmails sometimes sucks!!

On Oct 14, 2010 1:00pm, hid...@gmail.com wrote:
Finally did it, thank you all for your help, the code i will upload  
because can be used by Python 3 for handle the wsgi issue of the Bytes!



On Oct 12, 2010 5:28pm, Almar Klein almar.kl...@gmail.com> wrote:
>
>
>
> So if you can, you could make sure to send the file as just bytes,
>
> or if it must be a string, base64 encoded. If this is not possible
>
> you can try the code below to obtain the bytes, not a very fast
>
> solution, but it should work (Python 3):
>
>
>
>
>
> MAP = {}
>
> for i in range(256):
>
> MAP[tmp] = eval("'\\u%04i'" % i)
>
>
>
> >
>
> > # Let's say 'a' is your string
>
> > b''.join([MAP[c] for c in a])
>
> >
>
>
>
>
> I don't know what you're trying to do here.
>
>
>
> 1. 'tmp' is the same for every iteration of the 'for' loop.
>
>
>
> 2. A Unicode escape sequence expects 4 hexadecimal digits; the 'i'
>
> format gives a decimal number.
>
>
>
> 3. Using 'eval' to make a string this way is the long (and wrong) way
>
> to do it; chr(i) would have the same effect.
>
>
>
> 4. The result of the eval is a string, but you're performing a join
>
> with a bytestring, hence the exception.
> Mmm, you're right. I didn't look at this carefully enough, and then  
made an error in copying the source code. Sorry for that ...

>
> Here's a solution that should work (if I understand your problem  
correctly):

>
> your_bytes = bytes([ord(c) for c in your_string])
>
> Almar
>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parse xml

2010-10-15 Thread Hidura
First every element represents a node so you have to use
value=n.childNodes[0].nodeValue with that you'll have the 5000

2010/10/15, kostia :
> I have xml file:
> 
> 
> 5
> 
>
> I want to get the value of n (= 5) inside my python program, I'm
> doing this:
>
> import xml.dom.minidom
> from xml.dom.minidom import Node
> doc = xml.dom.minidom.parseString("boolean_width.xml")
> n = doc.getElementsByTagName("root")[0].firstChild.nodeValue.strip()
> print n
>
> and it is failed. How to get the value? Please, help.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list