strftime('%s')
'1341453600'
-- TZ=Asia/Tokyo python
>>> from datetime import datetime
>>> import pytz
>>> tz = pytz.timezone('Europe/Skopje')
>>> dt = datetime.fromtimestamp(1341446400, tz)
>>> dt
datetime.datetime(2012, 7, 5, 2, 0, tzinfo=CEST+2:00:00 DST>)
>>> dt.strftime('%s')
'1341421200'
Python 2.7.3, pytz 2012c
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
On 05.07.2012 16:10, Damjan wrote:
I've been struggling with an app that uses
Postgresql/Psycopg2/SQLAlchemy and I've come to this confusing
behaviour of datetime.datetime.
Also this:
#! /usr/bin/python2
# retardations in python's datetime
import pytz
TZ = pytz.timezone
I recommend you report it
as a bug against the pytz module.
It returns True, so it seems to be changed in the datetime object??
I tried both 2.7 and 3.2
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
a much larger memory address space footprint.
There's one function, called the gevent hub, that waits for any I/O
event and then switches to the function that "blocked" on that I/O.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
good references of using good times in Python?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ver TCP sockets.
Is there some python module that provides a multi process Queue?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
e modeled to be similar to python. The way it works is you feed the
template some data and it generates HTML documents. The document can have a
reference to a CSS file just like any other HTML page.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to see if the SELECT in cx_Oracle didn't return anything?
I want to optimize the situation when the number of selected rows is zero.
Is select count(*) the only option, seems inefficient?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
7;d like to avoid that unnecessary step.
c.rowcount will not give me the number of rows selected, it will only give
me the number of rows already fetched.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> Apart from that: what harm does the connection to the smpt do? If it
> works - keep it that way.
I worry about being banned from the server.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> I am a fresh here , and I have no idea of it.
> Do you have any comments?
Take a look at aether, a single CGI script and it's easy to understand.
http://www.logarithmic.net/pfh/aether
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
.. So, has anyone already done something similar?
A management web-ui would be nice too.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> Zope has WebDAV support and is written in Python. You could
> use Zope or perhaps use "parts" of it (since it is open source).
I wouldn't use Zope as file storage. The ZODB is inefficient for storing big
files.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
sy to use (prety much pythonic).
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
a Debian
libmysql but now has to work with the FreeBSD libmysql... I just don't
beleive you can make this work.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
.base64MIME.body_encode(s)
File "/usr/lib/python2.4/email/base64MIME.py", line 136, in encode
enc = b2a_base64(s[i:i + max_unencoded])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7:
ordinal not in range(128)
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
0 +0100
@@ -244,6 +244,8 @@
"""Convert a string from the input_codec to the output_codec."""
if self.input_codec <> self.output_codec:
return unicode(s, self.input_codec).encode(self.output_codec)
+elif isinstance(s, unico
;s not true (at least in 2.3 and 2.4):
>>> def f():
... return 'a'
...
>>> f.__auth__ = {1:'one'}
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> ... and being concerned to improve the library you logged this patch in
> Sourceforge for consideration by the developers?
>
> That's the only way to guarantee proper consideration of your fix.
Ok I will, can you confirm that the patch is correct?
Maybe I got something wr
in it, and then send the
result back.
I've made the most of my script, but I can't find a way to replace (freshen)
the file that's already in the archive?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
patch submitted...
> Thanks for taking the time to improve the quality of the Python library.
Do you think it would be possible to do some kind of an automatic
comprehensive test of compatibility of the standard library with unicode
strings?
--
damjan
--
http://mail.python.org/mail
This is a list of files I use to compile cx_Oracle, php-oci amd perl
DB::OCI on Linux.
I set ORACLE_HOME to /usr/lib/oracle and symlink the *.so files in
/usr/lib so that I don't need to set LD_LIBRARY_PATH.
I guess this list can be reduced some more... but I got tired of
experimenting
And the ins
Attached is the smallest test case, that shows that ElementTree returns
a
string object if the text in the tree is only ascii, but returns a
unicode
object otherwise.
This would make sense if the sting object and unicode object were
interchangeable... but they are not - one example, the translate
>> Do I need to check the output of ElementTree everytime, or there's some
>> hidden switch to change this behaviour?
>
> no.
>
> ascii strings and unicode strings are perfectly interchangable, with some
> minor exceptions.
It's not only translate, it's decode too... probably other methods and
beh
>>> ascii strings and unicode strings are perfectly interchangable, with
>>> some minor exceptions.
>>
>> It's not only translate, it's decode too...
>
> why would you use decode on the strings you get back from ET ?
Long story... some time ago when computers wouldn't support charsets
people
inven
Is there some tool that can help me design a simple curses wizards,
preferably one that uses Python, but if there's some other sollution I'd be
happy to hear. The important requirement is that its curses based (or
similar text based UI).
--
damjan
--
http://mail.python.org/mailma
> for python_code in c.fetchall():
> execute (python_code)
>
> Maybe feed python with stdin??.
eval
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
e script the src/ directory was added to the sys.path list.
If you relocate dir1/ and dir2/ in a "package" directory here it will not
work.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
on program were displayed
as if the "set names utf8" was not executed i.e. I got question marks where
utf-8 cyrillics should've appeared. After restarting the Python program
everything was ok, just as when I first started it.
The long running Python process is actually a scgi quixote
ther directory is added to the default
builtin sys.path.
In you case (the second case), you can import package.dir2.file2.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
.OperationalError:
db = MySQLdb.connect(godot.dbhost, godot.dbuser, godot.dbpass,
godot.dbname, use_unicode=1)
db.charset = 'utf8'
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
en
its stored in a database or file which I handle myself fine).
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
y to where your files are ("cd /path/to/files/").
execute them ("python my-script.py').
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
e very fast by calling an apache.send_file function.
see
http://www.modpython.org/pipermail/mod_python/2004-September/016471.html
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
w.owlfish.com/software/simpleTAL/)
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
how much of PyQT is ready for QT4?
Anyway its time for a PyQT based VB-killer [ a GPL one :) ].
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
be people that know how to compile :), and they'll be able to
release & distibute binaries... Previously you couldn't even compile the
GPL QT on windows, since it lacks the low-level win32 api calls that do all
the work.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
al to distribute it as source code.
> Am I bound by GPL? Certainly not, I did not sign or agree to it in way.
correct
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> One of the users on the Reportlabs mailing list was kinda enough to
> offer me the solution.. A simple call to the drawOn function, e.g.:
>
> bc = code39.Standard39("123",xdim = .015*inch)
whats code39 in this example?
> x = 6*inch
> y = -5*inch
> bc.drawOn(c
a
binary thats derived from GPL software (and you didn't publish it source
code under the GPL too).
> Nobody really knows what the GPL means when it gets down to it;
If you don't know, you should ask the person whose GPL code you are using.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Given the folowing XML snippet, I build an ElementTree instance with
et=ElementTree.fromstring(..). Now et.text returns just '\n text\n some
other text'.
Is there any way I could get everything between the and tag?
text
some other text
and then some more
--
damja
Or, much nicer
> if line[:5]=='start': printing=1
if line.startswith('start'): printing=1
> if line[:3]=='end': printing=0
if line.endswith('end'): printing=0
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
'\n text\n some other text\n and then some more\n'
And if there were attributes in I'd want them too where they were.
Can't I just get ALL the text between the tags?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> MySQLdb is working fine at command line, however when I tried to use
> it with mod_python, it give me a "server not initialized" error.
Maybe its this problem?
http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Python program (2.3.4 [GCC 3.3.3] on linux2)
import locale
locale.setlocale(locale.LC_ALL, "")
print locale.format("%'.2f", 1234567.89, grouping=True)
complains about the ' in the format
ValueError: unsupported format character ''' (0x27) at index 1
without the ' it outputs: 1234567,89
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
xecuting
the simple string expansion SQL % """""", I call the execute method
with the text as a second *parametar*. Everything else is magic :).
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> but perhaps the webserver sanitizes the output of CGI script and converts
> plain "\n" into "\r\n"
Yes apache does this, since it adds its own headers anyway it will replace
all '\n' in the headers with '\r\n' and '\n\n' with '\r\n\r
", 12)
draw.text((10, 10), text, font=font)
image.save('wow.jpg')
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ing mod_python there's no sys.argv (and what would it
contain if it existed??).
Now the real question is why PyChart needs sys.argv?
OTOH, maybe you can make a dummy sys module in your script that provides
sys.argv??
BTW, I tested with Apache 2.0.53, mod_python 3.1.4 and Python 2.4 to confirm
achine, or something like that.
>
> Can anyone tell me how I *do* get these names?
In linux (glibc) you can see all locales with "locale -a".
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
>> Read it as a string, and then decode it with the .decode method. You
>> specify what encoding it's in.
>
> Most probably, the OP is asking what to do with an UTF-8 encoded string.
>
> To decode that, just use:
>
> s.decode("utf-8")
I prefer:
unicode(s, 'utf-8')
That way it's more clear that
Do you want to create a SVG file or display a SVG file?
SVG files are just XML so maybe you can create them easyly?
--
http://mail.python.org/mailman/listinfo/python-list
> sorry for my ignorance, but after reading the Python tutorial on
> python.org, I'm sort of, well surprised about the lack of OOP
> capabilities in python. Honestly, I don't even see the point at all of
> how OO actually works in Python.
> For one, is there any good reason why I should ever inher
You can see some code here http://pysmpp.sourceforge.net/ but it's not
complete... it need much more work.
--
http://mail.python.org/mailman/listinfo/python-list
conversion:
> \uc3B4 => ô
'&#%d;' % ord(u'\u0430')
or
'&#x%x;' % ord(u'\u0430')
> for all available html entities.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ME, which is /usr/share/oracle on my system and it contains
bin/ install/ lib/ network/ ocommon/ oracore/ rdbms/ sqlplus/
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
t;
> But :
> $ python
>>>> import ftp_thread
> /
>
This has been documented in the blog posts titled "How well you know Python"
(find it on google)
The problem is that, once you run "import ftp_thread" a lock is set in the
Python interpreter, so then you can't start a new thread... (this from the
back of my mind).
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Damjan wrote:
> Panard wrote:
>
>> Hi,
>> I'm experiencing a strange problem while trying to manage a ftp
>> connection into a separate thread.
>>
>> I'm on linux, python 2.4.3
>>
>> Here is a test :
>> -- ftp_thread.p
uby (Rails or
not).. and from that little I've seen from it.. I didn't like it.
OTOH Ruby surelly is not that bad either.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
e first boot the machine would reboot on
exactly 2 minutes.
After a bit of poking around I found that hotplug detected the WDT support
and loaded the driver for it (i8xx_tco), and it seems the WDT chip was set
to start ticking right away after the driver poked it.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
el 2.6.17, and probably you could easily make it work if you make some
upgrades to Ubuntu.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
be
replaced with mod_python scripts.
OTOH SCGI or FastCGI seem better sutied for python web (WSGI) applications.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> I also recommend psycopg.
But make sure you use psycopg2
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
o that no environment variables are neccesseary -
>> actually this is not possible, but what I have is, symbolic links
>> in /usr/lib to the libraries in $ORACLE_HOME/lib, thus I don't need the
>> LD_LIBRARY_PATH variable, and the only other variable I need is the
>> ORACLE_HOME
n.3F
Now that it's GPL AppArmor seems to get a lot of supporters.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
e same
room with your software 100-fold if you release it under.. say GPL.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
like not in CGI) so:
s = wsgiref.simple_server.make_server('',8080, app)
s.server_forever()
More info at
http://wsgi.org/wsgi/Learn_WSGI
> 3. Using IIS at all for that matter, does WSGI work on IIS, do any
> frameworks?
There's an IIS server gateway (WSGI server) but you can always run WSGI
applications with CGI, as seen above.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
dea to use
> it in a wiki engine. Pro: versioning / diffs, Cons: you need your own
> svn/cvs repository, can pyLucene or Xapwrap index this?
You can certanly index the svn checkout if nothing else.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> QtNetwork
> A set of classes to support TCP and UDP socket programming and higher
> level protocols (eg. HTTP).
Since QtNetwork is asynchronous how does it compare to twisted?
I find Qt's signals and slots easier to understand and work with than
twisted deferreds.
> The odbc module is part of the Python Standard Library.
Since when?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
gt;
> This gives the following error:
>
> Traceback (most recent call last):
> File "", line 2, in ?
> TypeError: unbound method f() must be called with MyClass instance as
> first argument (got nothing instead)
>
> Please help...this is killing me!
What you a
an run your app as CGI, in mod_python, as a standalone http server,
with SCGI/FastCGI.
You'll benefit from authentication and session middleware. Middleware is a
great WSGI concept, there are also caching middlewares etc..
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
the app in the paste httpserver ...
# but make some error in your python code to see it's results
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ctually) so that the kernel/lib-loader can map them.
If your .egg package doesn't have any binary modules, then it doesn't need
to unpack anything.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
et the stdlib docs:
http://docs.python.org/lib/module-socket.html
http://docs.python.org/lib/module-select.html
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ite = (feed_title)
> AttributeError: 'file' object attribute 'write' is read-only
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ember the PIDs of the forked procesess and in your signal handler use
os.wait() to see which one has died.
BTW os.wait() can work in non-blocking mode .
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> I applaud you for studying the traceback in more depth than I can find
> the motivation for, Bruno. ;-) However, this looks like a program using
> some package installed by setuptools/easy_install needs to unpack that
> package when running.
See news:[EMAIL PROTECTED]
--
dam
viron and then provide that (either in
os.environ or in a custom environ dictionary).
BUT why don't you use WSGI?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
"]
>
> (but that can easily be spoofed, and is mostly meaningless if the user
> uses local IP addresses at the other side of the proxy, so you should
> use it with care)
Yep, you should only use "HTTP_X_FORWARDED_FOR" if you trust the proxy and
you check that the request
; address is not possible change.
I can setup my browser to always send you a fake HTTP_X_FORWARDED_FOR
header.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ich you don't control or create in your code.
I remeber I've seen an implementation of import_with_metaclass somewhere on
IBM's developerworks. I didn't quite undersntad it though.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ss B(UserDict):
... pass
>>> type(B)
It seems that NOT every class in my module will be a new style class,
especially those that inherit from other old-style classes in other
modules.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
manstey wrote:
> Hi,
>
> But this doesn't work if I do:
>
> a=object()
> x='bob'
> locals()[x] = a
>
> How can I do this?
try
sys.modules[__name__].__dict__[x] = a
But what's the point?
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
mplement some limiting features. Try two times
from the same IP address in less than 10 minutes and you are banned for the
day. Or some such.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
t of WSGI servers (server gateways)
http://wsgi.org/wsgi/Servers
Start from here to learn more:
http://wsgi.org/wsgi/Learn_WSGI
Then come back, we'll discuss
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ave been sold all the expensive proprietary tools
> so it's simply not fair when others are cheating.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
's already WSGI
middleware that's more flexible than the Apache modules for most of the
features you mention.
It's not that I think mod_python doesn't have uses.. I just think it's not
practical to make python web applications targeted solely to mod_python.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Then I got back to the Twisted book.
I think it needs more work.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
I just recompiled my python to link to ncursesw, and tried your example
with a little modification:
import curses, locale
locale.setlocale(locale.LC_ALL, '')
s = curses.initscr()
s.addstr(u'\u00c5 U+00C5 LATIN CAPITAL LETTER A WITH RING
ABOVE\n'.encode('utf-8') )
s.addstr(u'\u00f5 U+00F5 LATIN SMA
This is from the Slackware-current changelog:
d/python-2.4.2-i486-1.tgz: Upgraded to python-2.4.2.
The bsddb module didn't build against the new 4.4.x version of
Berkeley DB. Does anyone care? Or perhaps have a patch? :-)
Does anyone have a suggestion?
--
http://mail.python.org/ma
Just upgraded from 3.1.4 / Apache-2.0.55, and I can confirm that both
moin-1.5 and trac-0.9.3 continued to work without problems.
--
http://mail.python.org/mailman/listinfo/python-list
It seems that WSGI support starts to flourish is there some document or
a web site that tracks what's out there, some place to pick and choose
WSGI components?
--
http://mail.python.org/mailman/listinfo/python-list
> Because you wrote curentText - note the missing t.
:)
You mean the missing 'r'
:)
--
http://mail.python.org/mailman/listinfo/python-list
c = db.cursor()
c.execute(SQL, **args)
Same thing.
Everything works If I use python string substituion, like this sql:
SQL = """insert into D.D_NOTIFY values (%s,'%s','%s','%s','%s','%s', \
to_date('%s
vincent wehren wrote:
> |c = db.cursor()
> |c.execute(SQL, **args)
>
>
> Shouldn't that be c.execute(SQL, args) (no **-unpacking of the
> dictionary)?
Actually I tried that too, I still get the same error.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
ng a variable name other than "id" for the CARDREF variable... say
> "card_id". id is a built in function name; I suspect your problem may be
> that you are assiging that function to the variable rather than your
> intended value...
I changed it to 'cardref' but I'm still getting the same error.
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
> Last I looked (3.1-ish), Qt didn't use the Aqua widgets
Qt is now up to 4.3 and they use native Aqua
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Is there some project that implements web access to an IMAP store?
Maybe something AJAXy like http://roundcube.net/??
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
>
> is there a way to sort this string properly (sorted()?)
> I mean first 'a' then 'à' then 'e' etc. (sorted puts accented letters at
> the end). Or should I have to provide a comparison function to sorted?
After setting the locale...
locale.strcoll
1 - 100 of 138 matches
Mail list logo