sending ftp file list to mail???

2011-10-06 Thread selahattin ay

hi all. I want to get my ftp list and send the list to my mail adress... my 
codes are
from ftplib import FTP
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMETextbaglanti = FTP("ftp.guncelyorum.org")
baglanti.login("**", "***")
print baglanti.dir()
posta = MIMEMultipart()def posta_olustur():
posta['Subject']=konu
posta['From']=gmail_kullanici
posta['To']=kime
posta.attach(MIMEText(baglanti.retrlines("LIST")))  <-- what can I 
do for here 

def posta_gonder():
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_kullanici, gmail_sifre)
print "baglanti saglandi"
smtpserver.sendmail(gmail_kullanici, kime, posta.as_string())
print "Posta Gonderildi"
smtpserver.close()
 # mail to   
kime = raw_input("Kime gonderecesiniz?: ") 
# gmail user namegmail_kullanici = raw_input("gmail kullanici adiniz: ")
#gmail passgmail_sifre = raw_input("Gmail sifreniz: ")
#subjectkonu = raw_input ("Posta Konusu: ")
posta_olustur()
posta_gonder()

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


Re: PyDev 2.2.3 Released

2011-10-06 Thread rusi
On Oct 6, 11:03 pm, Fabio Zadrozny  wrote:
> Hi All,
>
> PyDev 2.2.3 has been released
>
> Details on PyDev:http://pydev.org
> Details on its development:http://pydev.blogspot.com

On my debian box I get:

$ /opt/Aptana\ Studio\ 3/AptanaStudio3
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught TypeError: Object [object Event],, has
no method 'toJSON',javascript::1)
HandleConsoleMessage(Uncaught ReferenceError: loadPortal is not
defined,http://content.aptana.com/aptana/my_aptana/?
content=start&id=83fef29f-0f3d-40db-8b9a-0f417b84cd8c&v=3.0.0.1316445268&ts=1317965412438&fg=f8f8f8&p=O&bg=141414&ch=edeceb:
59)
HandleConsoleMessage(AJS.Confluence: run binder components,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(Dropdown width override occurred,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(Dropdown width override occurred,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(Drag and Drop: requesting translation,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(DragAndDropUtils: computed cache URL: /s/en/
2159/26/1.0.16/_/plugins/drag-and-drop/i18n.action?locale=en_GB,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(Overriding default quick search,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(Applying doc-theme quick search,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
HandleConsoleMessage(confluence-keyboard-shortcuts initialising,http://
wiki.appcelerator.org/s/en/2159/26/58/_/download/superbatch/js/
batch.js:436)
[1007/110047:ERROR:base/native_library_linux.cc(28)] dlopen failed
when trying to open /opt/jre1.6.0_20/lib/i386/libnpjp2.so: /opt/
jre1.6.0_20/lib/i386/libnpjp2.so: undefined symbol:
__gxx_personality_v0
Job found still running after platform shutdown.  Jobs should be
canceled by the plugin that scheduled them during shutdown:
com.aptana.usage.StudioAnalytics$1

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


database connection

2011-10-06 Thread masood shaik
Hi

 can u please tell me how we can connect to database without changing
the permission of db file using sqlite3

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


Re: Deleting files on a shared server

2011-10-06 Thread Josh English
The problem shows up when the application starts. It tries to read the file but 
the lock mechanism times out because the file is still around after the last 
time the application ran.

It's a wxPython program. The code to unlink the .lock files is run in the 
wxApp.OnInit method (before any code to open these resources) and in the 
wxApp.OnExit method. I know both of these methods are being called.

The locking mechanism I am using can be found at 
http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/

The clearing code is:

import os
import fnmatch
files = fnmatch.filter(os.listdir(self.Options.DataDir), "*.lock")
for f in files:
os.unlink(os.path.abspath(os.path.join(self.Options.DataDir, f)))

The Options object has a property called DataDir.

MMM...

Now that I sit down to test abso-frikkin'-lutely that this code does what I 
want it to do, it appears not to do this at all. The files list I build doesn't 
work and returns an empty list. I may have found a workaround using glob.

Now my face is red. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-06 Thread alex23
Dennis Lee Bieber  wrote:
>         While I wouldn't want to write an FFT in COBOL, one can't deny that
> laying out fixed width reports and moving blocks of decimal data between
> record layouts is quite easy in COBOL.

Well, sure, but there's still plenty of pain in the verbosity :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: L.A. user group?

2011-10-06 Thread Miki Tebeka
Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Deleting files on a shared server

2011-10-06 Thread Steven D'Aprano
Josh English wrote:

> This is a follow-up to some questions I posted a month or two ago. I have
> two programs running on various Windows XP boxes, sharing several resource
> files on a Windows 2003 server. It's a mapped drive on the workstations to
> a shared folder.
> 
> I am using a locking utility that works by creating ".lock" files in the
> shared folder and deleting those files when the program is done with them.
> 
> To delete the files, I am using os.unlink.

How and when? If you are deleting the files using a __del__ handler in an
instance, it is quick possible that it is never being run, or not being run
when you think it is.

For file locking, you should consider using a portable solution like this
one:

http://code.activestate.com/recipes/65203-portalocker-cross-platform-posixnt-api-for-flock-s/

 
> One lock file refuses to disappear, even though I have code at both
> application startup and shutdown (on the OnInit and OnExit methods to the
> wxPython Application object) that hunts down .lock files and deletes them.

Perhaps the file is open and so can't be deleted under Windows. Are you
getting an exception when you try to unlink the file? If so, what does it
say?


> Is there a better command than os.unlink to delete a file on Windows 2003
> server?

No. os.unlink is a wrapper around your system's unlink command -- if it
can't delete the file, you can't delete the file.


-- 
Steven

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


Re: A tuple in order to pass returned values ?

2011-10-06 Thread Steven D'Aprano
Jean-Michel Pichavant wrote:

> In a general manner, ppl will tend to use the minimum arguments
> required. However, do not pack values into tuple if they are not related.

How would you return multiple values if not in a tuple?

Tuples are *the* mechanism for returning multiple values in Python. If
you're doing something else, you're wasting your time.


> A better thing to do would be to use objects instead of tuples, tuples
> can serve as lazy structures for small application/script, they can
> become harmful in more complexe applications, especialy when used in
> public interfaces.

First off, tuples *are* objects, like everything else in Python.

If you are creating custom classes *just* to hold state, instead of using a
tuple, you are wasting time. Instead of this:

class Record:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z

result = Record(1, 2, 3)

Just use a tuple or a namedtuple: the work is already done for you, you have
a well-written, fast, rich data structure ready to use. For two or three
items, or for short-lived results that only get used once, an ordinary
tuple is fine, but otherwise a namedtuple is much better:

from collections import namedtuple
result = namedtuple('Record', 'x y z')(1, 2, 3)



-- 
Steven

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


Deleting files on a shared server

2011-10-06 Thread Josh English
This is a follow-up to some questions I posted a month or two ago. I have two 
programs running on various Windows XP boxes, sharing several resource files on 
a Windows 2003 server. It's a mapped drive on the workstations to a shared 
folder.

I am using a locking utility that works by creating ".lock" files in the shared 
folder and deleting those files when the program is done with them.

To delete the files, I am using os.unlink.

One lock file refuses to disappear, even though I have code at both application 
startup and shutdown (on the OnInit and OnExit methods to the wxPython 
Application object) that hunts down .lock files and deletes them.

Is there a better command than os.unlink to delete a file on Windows 2003 
server?

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


Re: passing multiple string to a command line option

2011-10-06 Thread Mahmood Naderan
>Without seeing the code of SimObject and params I can't tell much more.

>    File "/home/mahmood/gem5/src/python/m5/params.py", line 159, in convert
>      return self.ptype(value)

following is part of params.py and I marked line 159.
I didn't wrote this code so changing this may cause problem with other files.

If there is an alternative for doing such thing "passing multiple strings to 
command line option", it is  much better.

 # Regular parameter description.
class ParamDesc(object):
    file_ext = 'ptype'

    def __init__(self, ptype_str, ptype, *args, **kwargs):
    self.ptype_str = ptype_str
    # remember ptype only if it is provided
    if ptype != None:
    self.ptype = ptype

    if args:
    if len(args) == 1:
    self.desc = args[0]
    elif len(args) == 2:
    self.default = args[0]
    self.desc = args[1]
    else:
    raise TypeError, 'too many arguments'

    if kwargs.has_key('desc'):
    assert(not hasattr(self, 'desc'))
    self.desc = kwargs['desc']
    del kwargs['desc']

    if kwargs.has_key('default'):
    assert(not hasattr(self, 'default'))
    self.default = kwargs['default']
    del kwargs['default']

    if kwargs:
    raise TypeError, 'extra unknown kwargs %s' % kwargs

    if not hasattr(self, 'desc'):
    raise TypeError, 'desc attribute missing'

    def __getattr__(self, attr):
    if attr == 'ptype':
    ptype = SimObject.allClasses[self.ptype_str]
    assert isSimObjectClass(ptype)
    self.ptype = ptype
    return ptype

    raise AttributeError, "'%s' object has no attribute '%s'" % \
  (type(self).__name__, attr)

    def convert(self, value):
    if isinstance(value, proxy.BaseProxy):
    value.set_param_desc(self)
    return value
    if not hasattr(self, 'ptype') and isNullPointer(value):
    # deferred evaluation of SimObject; continue to defer if
    # we're just assigning a null pointer
    return value
    if isinstance(value, self.ptype):
    return value
    if isNullPointer(value) and isSimObjectClass(self.ptype):
    return value
    return self.ptype(value) # LINE 159

    def cxx_predecls(self, code):
    self.ptype.cxx_predecls(code)

    def swig_predecls(self, code):
    self.ptype.swig_predecls(code)

    def cxx_decl(self, code):
    code('${{self.ptype.cxx_type}} ${{self.name}};')



// Naderan *Mahmood;


- Original Message -
From: Miki Tebeka 
To: comp.lang.pyt...@googlegroups.com
Cc: python mailing list ; Mahmood Naderan 

Sent: Thursday, October 6, 2011 9:55 PM
Subject: Re: passing multiple string to a command line option

As far as I see, the problem is not in the command line but in     
system.cpu[i].workload = process[i] call tree.

Without seeing the code of SimObject and params I can't tell much more.

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


Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

2011-10-06 Thread John Gordon
In  xDog Walker 
 writes:

> What is this  io  of which you speak?

It was introduced in Python 2.6.

-- 
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


Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

2011-10-06 Thread xDog Walker
On Thursday 2011 October 06 10:41, jmfauth wrote:
> or  (Python2/Python3)
>
> >>> import io
> >>> with io.open('abc.txt', 'r', encoding='iso-8859-2') as f:
>
> ...     r = f.read()
> ...
>
> >>> repr(r)
>
> u'a\nb\nc\n'
>
> >>> with io.open('def.txt', 'w', encoding='utf-8-sig') as f:
>
> ...     t = f.write(r)
> ...
>
> >>> f.closed
>
> True
>
> jmf

What is this  io  of which you speak?

-- 
I have seen the future and I am not in it.

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


Re: passing multiple string to a command line option

2011-10-06 Thread Miki Tebeka
As far as I see, the problem is not in the command line but in 
system.cpu[i].workload = process[i] call tree.

Without seeing the code of SimObject and params I can't tell much more.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: L.A. user group?

2011-10-06 Thread Brian Curtin
On Thu, Oct 6, 2011 at 12:24, Miki Tebeka  wrote:
> Greetings,
>
> Is there an L.A. Python user group out there?

http://socal-piggies.org might work for you. They recently had a
meeting in Santa Monica, and I believe many of the members are LA
based.
-- 
http://mail.python.org/mailman/listinfo/python-list


PyDev 2.2.3 Released

2011-10-06 Thread Fabio Zadrozny
Hi All,

PyDev 2.2.3 has been released

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com

Release Highlights:
---

* Performance improvements

* Major: Fixed critical issue when dealing with zip files.

* Added option to create method whenever a field would be created in
quick fixes (and vice-versa), to properly deal with functional
programming styles.

* Fixed issue where PyDev was changing the image from another plugin
in the Project Explorer (i.e.: removing error decorations from JSP).

* Fixed issue: if the django models was opened in PyDev, the 'objects'
object was not found in the code analysis.

* Test runner no longer leaves exception visible.

* Fixed issue on Py3: Relative imports are only relative if they have
a leading dot (otherwise it always goes to the absolute).

* Default is now set to create project with the projects itself as the
source folder.

* Handling deletion of .class files.

* Fixed issue where loading class InterpreterInfo in
AdditionalSystemInterpreterInfo.getPersistingFolder ended up raising a
BundleStatusException in the initialization.

* Fixed some code formatting issues


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython
and IronPython development -- making Eclipse a first class Python IDE
-- It comes with many goodies such as code completion, syntax
highlighting, syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

Appcelerator
http://appcelerator.com/

Aptana
http://aptana.com/

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

2011-10-06 Thread jmfauth
On 6 oct, 06:39, Greg  wrote:
> Brilliant! It worked. Thanks!
>
> Here is the final code for those who are struggling with similar
> problems:
>
> ## open and decode file
> # In this case, the encoding comes from the charset argument in a meta
> tag
> # e.g. 
> fileObj = open(filePath,"r").read()
> fileContent = fileObj.decode("iso-8859-2")
> fileSoup = BeautifulSoup(fileContent)
>
> ## Do some BeautifulSoup magic and preserve unicode, presume result is
> saved in 'text' ##
>
> ## write extracted text to file
> f = open(outFilePath, 'w')
> f.write(text.encode('utf-8'))
> f.close()
>



or  (Python2/Python3)

>>> import io
>>> with io.open('abc.txt', 'r', encoding='iso-8859-2') as f:
... r = f.read()
...
>>> repr(r)
u'a\nb\nc\n'
>>> with io.open('def.txt', 'w', encoding='utf-8-sig') as f:
... t = f.write(r)
...
>>> f.closed
True

jmf

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


L.A. user group?

2011-10-06 Thread Miki Tebeka
Greetings,

Is there an L.A. Python user group out there?

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


Re: passing multiple string to a command line option

2011-10-06 Thread Terry Reedy

On 10/6/2011 11:27 AM, Mahmood Naderan wrote:

Dear developers,
Suppose I have this list in command line options:
... -b b1,b2,b3

Here is what I wrote:
parser = optparse.OptionParser()


If you are starting a new project, consider using argparse, which has 
superceded optparse.



# Benchmark options
parser.add_option("-b", "--benchmark", default="", help="The benchmark to be 
loaded.")
process = []
benchmarks = options.benchmark.split(',')
for bench_name in benchmarks:
 process.append(bench_name)

At this stage, I want to bind each process to something:
np = 2
for i in xrange(np):
 ...
 system.cpu[i].workload = process[i]

however I get this error:

   File "configs/example/cmp.py", line 81, in
 system.cpu[i].workload = process[i]
   File "/home/mahmood/gem5/src/python/m5/SimObject.py", line 627, in 
__setattr__
 value = param.convert(value)
   File "/home/mahmood/gem5/src/python/m5/params.py", line 236, in convert
 tmp_list = [ ParamDesc.convert(self, value) ]
   File "/home/mahmood/gem5/src/python/m5/params.py", line 159, in convert
 return self.ptype(value)
TypeError: __init__() takes exactly 1 argument (2 given)
Error setting param TmpClass.workload to bzip2_chicken

params.py is part of the simulator and I didn't wrote that.

My question is what is the simplest way to fix that?
Or is there any better idea than what I did in order to parse such command line 
option?

  thanks

// Naderan *Mahmood;



--
Terry Jan Reedy

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


Re: Dabo 0.9.4 Released!

2011-10-06 Thread Neal Becker
Ed Leafe wrote:

> Yes, it's been over a year, but today we're finally releasing Dabo 0.9.4!
> 
> What can I say? While we've been actively developing Dabo all along, and
> committing improvements and fixes regularly, we don't seem to get around to
> doing releases as often as we should. Since Dabo has a Web Update feature that
> lets developers receive regular updates between releases, most people are
> fairly current, but creating a new release will help newcomers to Dabo get up
> to speed quicker.
> 
> The changes won't be too big for most current users of the framework, but
> compared to the 0.9.3 release, lots has been fixed and improved! Full release
> notes are at: http://svn.dabodev.com/dabo/tags/dabo-0.9.4/ChangeLog
> 
> ...but here are just a few of the major changes since 0.9.3:
> 
> - better handling of edge cases in bizobj relations
> - addition of support in bizobjs for many-to-many relationships
> - improved efficiency in detecting changed records
> - added the dDatePicker control
> - added the option of vertical text for grid headers
> - integrated a code editor into the command window
> 
> You can grab the latest version, as always, from http://dabodev.com/download
> 
> 
> 
> -- Ed Leafe

What is it?

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


Re: Implementing Python-OAuth2

2011-10-06 Thread Jeff Gaynor

On 10/06/2011 08:34 AM, Kayode Odeyemi wrote:

Hello friends,

I'm working on a pretty large application that I will like to use 
oauth2 on as an authentication and authorization mechanism.


I understand fairly the technology and I have written my own 
implementation before I stumbled on python-oauth2.


I need advise on leveraging python-oauth2 api for creating consumer 
key, creating consumer secret, access token and token secret.


This works well, but be advised that the original python oauth library 
had some serious issues, so was redone as python-oauth2. What is 
confusing is that it refers to OAuth version 1.0a, not the upcoming 
OAuth version 2.0, so make sure you read the right spec before using it, 
since they are very different indeed.


There are *no* usable OAuth version 2..0 implementation in any language 
(usually Java comes first) that I know of, so you will get to role your 
own, which is hard. There are a few beta-level versions E.g. Twitter) 
but these are special cased to the author's needs. The spec itself is 
not quite ready either and since it has changed quite substantially in 
the last year, I suspect that everyone is waiting to see it settle to a 
steady state.


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


ANN: hgview 1.4.0 - Mercurial log navigator

2011-10-06 Thread Alain Leufroy
Announcing HgView 1.4.0
===

HgView home page:
http://www.logilab.org/project/hgview

Tarball:
http://ftp.logilab.org/pub/hgview/hgview-1.4.0.tar.gz

Hg repository:
http://www.logilab.org/src/hgview

About this release
==

Text mode inside make it into hgview 1.4.0!

This release introduces a *new text based* user interface thanks to the
urwid library (http://excess.org/urwid )

This interface includes the following features:

* display the revision graph (with working directory as a node, and basic 
support for the mq),
* display the files affected by a selected changeset (with basic support for 
the bfiles),
* display diffs (with syntax highlighting thanks to pygments),
* automatically refresh the displayed revision graph when the repository is 
being modified,
* easy key-based navigation in revisions' history of a repo (same as the GUI),
* a command system for special actions (see help)

To use it type : ``hgview --interface curses`` (or configure it permanently in 
your config file)

There are also some bugfixes.

About HgView


hgview is a simple tool aiming at visually navigate in a Mercurial (hg) 
repository history.
It is written in Python with quick and efficient key-based navigation in mind, 
trying to be fast
enough for big repositories.

 --$
python-projects mailing list
http://lists.logilab.org/mailman/listinfo/python-projects

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


passing multiple string to a command line option

2011-10-06 Thread Mahmood Naderan
Dear developers,
Suppose I have this list in command line options:
... -b b1,b2,b3

Here is what I wrote:
parser = optparse.OptionParser()
# Benchmark options
parser.add_option("-b", "--benchmark", default="", help="The benchmark to be 
loaded.")
process = []
benchmarks = options.benchmark.split(',')
for bench_name in benchmarks:
    process.append(bench_name)
    
At this stage, I want to bind each process to something:
np = 2
for i in xrange(np): 
    ...
    system.cpu[i].workload = process[i]

however I get this error:

  File "configs/example/cmp.py", line 81, in 
    system.cpu[i].workload = process[i]
  File "/home/mahmood/gem5/src/python/m5/SimObject.py", line 627, in __setattr__
    value = param.convert(value)
  File "/home/mahmood/gem5/src/python/m5/params.py", line 236, in convert
    tmp_list = [ ParamDesc.convert(self, value) ]
  File "/home/mahmood/gem5/src/python/m5/params.py", line 159, in convert
    return self.ptype(value)
TypeError: __init__() takes exactly 1 argument (2 given)
Error setting param TmpClass.workload to bzip2_chicken

params.py is part of the simulator and I didn't wrote that.

My question is what is the simplest way to fix that?
Or is there any better idea than what I did in order to parse such command line 
option?

 thanks

// Naderan *Mahmood;
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A tuple in order to pass returned values ?

2011-10-06 Thread Jean-Michel Pichavant

faucheuse wrote:

Hi, (new to python and first message here \o/)

I was wondering something :
when you do : return value1, value2, value3
It returns a tuple.

So if I want to pass these value to a function, the function have to
look like :
def function(self,(value1, value2, value3)) #self because i'm working
with classes

I tried it, and it works perfectly, but I was wondering if it's a good
choice to do so, if there is a problem by coding like that.

So my question is : Is there a problem doig so ?
  

There is no problem with that but ppl will usually write something like:

def function(self, a3Tuple):
   v1, v2 ,v3 = a3Tuple

In a general manner, ppl will tend to use the minimum arguments 
required. However, do not pack values into tuple if they are not related.
A better thing to do would be to use objects instead of tuples, tuples 
can serve as lazy structures for small application/script, they can 
become harmful in more complexe applications, especialy when used in 
public interfaces.


JM


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


Dabo 0.9.4 Released!

2011-10-06 Thread Ed Leafe
Yes, it's been over a year, but today we're finally releasing Dabo 
0.9.4!

What can I say? While we've been actively developing Dabo all along, 
and committing improvements and fixes regularly, we don't seem to get around to 
doing releases as often as we should. Since Dabo has a Web Update feature that 
lets developers receive regular updates between releases, most people are 
fairly current, but creating a new release will help newcomers to Dabo get up 
to speed quicker.

The changes won't be too big for most current users of the framework, 
but compared to the 0.9.3 release, lots has been fixed and improved! Full 
release notes are at:
http://svn.dabodev.com/dabo/tags/dabo-0.9.4/ChangeLog

...but here are just a few of the major changes since 0.9.3:

- better handling of edge cases in bizobj relations
- addition of support in bizobjs for many-to-many relationships
- improved efficiency in detecting changed records
- added the dDatePicker control
- added the option of vertical text for grid headers
- integrated a code editor into the command window

You can grab the latest version, as always, from 
http://dabodev.com/download



-- Ed Leafe



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


Implementing Python-OAuth2

2011-10-06 Thread Kayode Odeyemi
Hello friends,

I'm working on a pretty large application that I will like to use oauth2 on
as an authentication and authorization mechanism.

I understand fairly the technology and I have written my own implementation
before I stumbled on python-oauth2.

I need advise on leveraging python-oauth2 api for creating consumer key,
creating consumer secret, access token and token secret.

Regards

-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing file out to another machine

2011-10-06 Thread Dave Angel

On 01/-10/-28163 02:59 PM, Dennis Lee Bieber wrote:

On Wed, 05 Oct 2011 21:36:34 -0400, Terry Reedy
declaimed the following in gmane.comp.python.general:


On 10/5/2011 5:31 PM, Chris Angelico wrote:

On Thu, Oct 6, 2011 at 8:22 AM, John Gordon   wrote:

I assume he intended "S:" to indicate a remote server.


The most obvious understanding of it is a drive letter (ie Windows
box).

More exactly, a remote server filesystem 'mounted' (not sure of the
Windows' term) as a local drive. I am pretty sure I have read of this
being done.


"My Computer"

"Map Network Drive"

So I suspect you could refer to it as a "mapped" filesystem.
Or you could refer to it as a 'net use' drive, since that's the 
commandline way to mount it on Windoze.


DaveA

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


The hyper fused upper part of Nike Air Max displays the humanity

2011-10-06 Thread fashion fans


The hyper fused upper part of Nike Air Max displays the humanity of
the designer because of its lightweight, breathability and a feeling
of plusher fitness. The mesh inner collar, and the soft springy
cushion http://www.outlet-nike-air-max.com/inside can protect the feet
against most possible injures. Besides the rubber materials around the
translucent perimeter displays a particular appearance of the shoes,
which is a love of most women, especially those who pursuit to be in
fashion. Meanwhile the rubber material is a guaranty of the durability
and traction, which is fully the practice. With the {2}{/2}dynamic
colors of Women’s Nike Air Max 2011, you will soon experience the
vitality of sports when you are dressed in such a pair of classic nice
cheap Nike running shoes, because it can not only create a healthy
condition for feet, but also can restore the original active in the
shortest time. What’s more, the Nike Air Max 2011 will not cause any
exacerbation if you once were injured in feet.
http://www.outlet-nike-air-max.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

2011-10-06 Thread Chris Angelico
On Thu, Oct 6, 2011 at 8:29 PM, Ulrich Eckhardt
 wrote:
> Just wondering, why do you split the latter two parts? I would have used
> codecs.open() to open the file and define the encoding in a single step. Is
> there a downside to this approach?
>

Those two steps still happen, even if you achieve them in a single
function call. What Steven described is language- and library-
independent.

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


Re: encoding problem with BeautifulSoup - problem when writing parsed text to file

2011-10-06 Thread Ulrich Eckhardt

Am 06.10.2011 05:40, schrieb Steven D'Aprano:

(4) Do all your processing in Unicode, not bytes.

(5) Encode the text into bytes using UTF-8 encoding.

(6) Write the bytes to a file.


Just wondering, why do you split the latter two parts? I would have used 
codecs.open() to open the file and define the encoding in a single step. 
Is there a downside to this approach?


Otherwise, I can only confirm that your overall approach is the easiest 
way to get correct results.


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


Re: httplib2 download forbidden

2011-10-06 Thread Mauro Zaccariotto
On 6 Ott, 09:05, Tim Roberts  wrote:
> Mauro Zaccariotto  wrote:
>
> >Hi! does anyone know what's happening herehttp://code.google.com/p/httplib2/
> >? I get this:
> >"403. That s an error.
> >Your client does not have permission to get URL /p/httplib2/ from this
> >server. That s all we know."
>
> It's working for me.  Do you have some kind of proxy in the way?
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.

No, but today it's working again. O__o
thank you anyway
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simplest way to resize an image-like array

2011-10-06 Thread John Ladasky
On Oct 1, 2:22 am, John Ladasky  wrote:
> On Sep 30, 1:51 pm, Jon Clements  wrote:
>
> > Is something like
> >http://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imresi...
> > any use?
>
> There we go!  That's the kind of method I was seeking.  I didn't think
> to look outside of scipy.interpolate.  Thanks, Jon.

Oh, grumble, scipy.misc.imresize bumps the array down to an 8-bit
integer array.  I need to do some arithmetic with the arrays, and it
needs to be more precise than 8 bits.  So I may have to rewrite the
function to yield a 16-bit integer at least.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: httplib2 download forbidden

2011-10-06 Thread Tim Roberts
Mauro Zaccariotto  wrote:
>
>Hi! does anyone know what's happening here http://code.google.com/p/httplib2/
>? I get this:
>"403. That’s an error.
>Your client does not have permission to get URL /p/httplib2/ from this
>server. That’s all we know."

It's working for me.  Do you have some kind of proxy in the way?
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib and parsing

2011-10-06 Thread Tim Roberts
luca72  wrote:
>
>Hello i have a simple question:
>up to now if i have to parse a page i do as follow:
>...
>Now i have the site that is open by an html file like this:
>...
>how can i open it with urllib, please note i don't have to parse this
>file, but i have to parse the site where he point.

Well, you can use htmllib to parse the HTML, look for the "form" tag, and
extract the "action" verb.  Or, if you really just want this one site, you
can use urllib2 to provide POST parameters:

  import urllib
  import urllib2

  url = 'http://lalal.hhdik/'
  values = {'password' : 'password',
'Entra' : 'Entra' }

  data = urllib.urlencode(values)
  req = urllib2.Request(url, data)
  response = urllib2.urlopen(req)
  the_page = response.read()
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list