datetime issue

  • Thread starter Íéêüëáïò Êïýñáò
  • Start date
T

Terry Reedy

If i ditch google groups

PLEASE DO
what application can i use in Windows 8 to post to this newsgroup
and what newsserver too?

news.gmane.org is a free newsserver that mirrors 1000s of technical
email lists. python-list is gmane.comp.python.general. There are 100s of
other gmane.comp.python.* groups.

I use Thunderbird on Win7 because it does both mail and news. I
previously used Outlook Express for same. There are others.
 
G

Gene Heskett

wait a minute! i must use my ISP's news server and then post o
comp.lang.python no?
No.

What is (e-mail address removed) how can i post there?

Install thunderbird. Its a real email agent, even on a windows box.

But first you must subscribe as I discussed in a previous msg.

Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
Q: How was Thomas J. Watson buried?
A: 9 edge down.
 
S

Steven D'Aprano

If i ditch google groups what application can i use in Windows 8 to post
to this newsgroup and what newsserver too?

Google is your friend. Do try to find the answer to your questions before
asking here.

Search for "usenet news reader application". Or use Thunderbird.

For the news server, you use your ISP's newserver, if they offer one, or
Gmane, or any of dozens of commercial news providers who will give you
access to one for a small fee.
 
S

Steven D'Aprano

What is (e-mail address removed) how can i post there?

It's the same thing it was when I posted the above URL a few hours ago.

Didn't you follow the link before? It has instructions there.
 
M

Mark Lawrence

I've dithered about whether to open this can of worms or let sleeping
dogs lie, and I finally decided to make some metaphor potpourri.

Simple UTC offsets are not the same thing as local time. There are a
variety of other considerations, but the main one is Daylight Robbery
Time, where every government wants to put its own stamp on things by
fiddling with the DST rules a bit. Most places will move their clocks
an hour forward for summer and then back for winter. But!

* Some places are sensible and don't have DST at all (eg
Australia/Queensland, America/Arizona)
* Northern hemisphere summer corresponds to southern hemisphere
winter, and vice versa
* Everyone has a different way of defining the boundaries of summer and winter
* And just to confuse us all, Irish Standard Time is used in summer,
and they *subtract* an hour for winter time!

The only way to handle timezones correctly and keep yourself even
marginally sane is to hand the job on to somebody else. I dodged the
whole issue by letting our Postgres database handle everything for us
(date/time formats, timezones, the lot), and having our internal
systems all just work in UTC. You'll likely find it easiest to do the
same thing with a Python library.

Just don't try to pretend to yourself that Greece uses GMT+2, because
it's not that simple. For one thing, it's currently summer there...

ChrisA

I guess that Double British Summer Time made things twice as difficult?
 
M

Mark Lawrence

wait a minute! i must use my ISP's news server and then post o comp.lang.python no?

What is (e-mail address removed) how can i post there?

I'm on Windows Vista and read many Python mailing lists with Thunderbird
via gmane.
 
D

Dave Angel

Ôç ÊõñéáêÞ, 16 Óåðôåìâñßïõ 2012 2:34:34 ì.ì. UTC+3, ï ÷ñÞóôçò Steven D'Aprano Ýãñáøå:

Once you get the emails from the official mailing list, posting a reply
is straightforward. Do a reply-all for most messages, perhaps deleting
some of the to or cc addresses depending on a specific message. Then
trim the parts you're not responding to, and put your new remarks after
the context you are responding to. It won't double-post.

For new messages, simply address a new message to (e-mail address removed)

Depending on your mail reader, you can see the messages in threads,
except for all the people who bust up the threads. When you get to that
point, post a new thread specifying your email program and OS, and
somebody will probably volunteer to help you get it customized (though
perhaps the actual discussion for that would be offline).

For anybody else listening, the way I avoid seeing the google-groups
double-post is to automatically delete any message that's got a cc to
google-groups. That way I only get the OTHER copy of the message.
 
D

Dennis Lee Bieber

import pytz fails in my webhost unfortunately :(
This module is not supported by hostgator.

I presume you are able to install your own Python scripts, or you
wouldn't even be able to try the import.

So far as I can see, pytz is a pure Python package -- no binaries...
You should be able to extract it onto your local development machine,
then copy the entire pytz system from your site-packages to whereever
you install your Python scripts. You might have to tweak (from inside
your script) the pythonpath before doing the import, but it should be
doable.

If not, then I suggest you study the Python Library reference
section for the datetime module -- in particular the part about using
the tzinfo class, and implement just enough to do your time translation.
Most of pytz is just an implementation of the tzinfo class along with a
database of recognized world timezones and offsets.
 
D

Dennis Lee Bieber

The line should be this:

date = (datetime.datetime.utcnow() + datetime.timedelta(hours=8)
).strftime('%Y-%m-%d %H:%M:%S')
I think "hours = 2"... UTC to Athens is two hours... the OP was
trying 8 hours to get from US Central to Greece (and not accounting for
possible daylight savings times)
 
A

alex23

Using Google Groups for posting to Usenet has been a bad idea for a long
time, but now it just seems to be a sure recipe for annoying the rest of
us. Again, not something you have much control over, except to stop
using Google Groups.

Agreed. While it was painful but usable in its previous form, the "new
Groups" is an incomprehensible mess of pointlessness and shittery.
It's still possible to use the old theme for the time being, which
does avoid the double-up posts, but it's pretty clear Google aren't
listening to any feedback about Groups whatsoever.

I've really NFI why they bought DejaNews only to turn it into such a
broken service.
 
R

Roy Smith

alex23 said:
Agreed. While it was painful but usable in its previous form, the "new
Groups" is an incomprehensible mess of pointlessness and shittery.
It's still possible to use the old theme for the time being, which
does avoid the double-up posts, but it's pretty clear Google aren't
listening to any feedback about Groups whatsoever.

I've really NFI why they bought DejaNews only to turn it into such a
broken service.

They didn't buy the service. They bought the data. Well, they really
bought both, but the data is all they wanted.
 
A

alex23

They didn't buy the service.  They bought the data.  Well, they really
bought both, but the data is all they wanted.

I thought they'd taken most of the historical data offline now too?

Either way, it was the sort of purchase-and-whither approach you
usually see Yahoo take.
 
M

Matteo Boscolo

Hi All,

I'm facing some trouble with a win32com application, it seems, that some
com object (win32com) are still in the gc.get_objetc() list, even if I
set to non the objetc and I'm out of the scope of that objects.

What I'm try to do is to remove this object from the list. but I do
know how..

the .__del__() method dose not work on this object...

there is someone that can give me some help on this ?

Regards,
Matteo
 
J

Jamie Paul Griffin

[ Joel Goldstick wrote on Sun 16.Sep'12 at 11:57:56 -0400 ]
email client to (e-mail address removed)

If using Windows I would certainly use Thunderbird or even slrn news reader - I believe there is a version for Windows. Or you could install Interix subsystem which provides UNIX tools for Windows 7 Ultimate or Professional. You'd then have some more choice of MUA client or newsreader client in that environment. Cygwin is another alternative.

UNIX systems just use whatever email client you like and subscribe to the list as explained several times by others. Fortunately for me I've got procmail deleting double posts because they are annoying.
 
S

Steven D'Aprano

Hi All,

I'm facing some trouble with a win32com application, it seems, that some
com object (win32com) are still in the gc.get_objetc() list, even if I
set to non the objetc and I'm out of the scope of that objects.

You can't set an object to None. An object is itself. It is *always*
itself, you can't tell Python to turn it into None.

What you can do is re-bind a *name* from an object to None.

Suppose you say:

x = Spam()

then there is a binding between name "x" and the object Spam(), which I
will call "spam" from now on. When you then later say:

x = None

this does *not* convert spam into None, what it does is cuts the binding
between name "x" and spam, and binds the name "x" to None. The object
spam still exists.

If there are no other references to spam, then the garbage collector
automatically destroys the spam object. But if there are still references
to the spam object, then it will remain alive, and the gc will keep
tracking it.

References can include:

* name bindings: x = spam

* list items: mylist.append(spam)

* dict keys and values: mydict[spam] = 42; mydict["key"] = spam

* attributes: myobject.attr = spam

* default values to function parameters: def foo(a, b=spam): ...

and probably others.

What I'm try to do is to remove this object from the list. but I do
know how..


If you have a com object being tracked by the garbage collector, that
means that it is still in use, somewhere in your program. You can't just
tell the gc to stop tracking it. You need to find where you still have a
reference to the object.

the .__del__() method dose not work on this object...

The __del__ method does not delete an object. Remember, objects are only
deleted when there are no references to it. Otherwise you could have some
code that tries to use a deleted object, and you would get a system crash
or BSOD. The __del__ method is called only when the object is *just
about* to be deleted.

In general, you should avoid using __del__ methods. They interfere with
the garbage collector's ability to resolve cycles. The problem is, what
happens if an object contains a link to itself?

x = []
x.append(x)

Such cycles could be very deep:

a = []; b = []; c = []; d = []; ... y = []; z = []
a.append(b)
b.append(c)
c.append(d)
....
y.append(z)
z.append(a) ### a cycle appears ###

Now you have a cycle of 26 objects, each of which indirectly refers to
itself.

Normally, Python's garbage collector can recognise such a cycle and
safely break it, which then allows all of the objects to be deleted. But
if you add a __del__ method to *even one* object, Python can no longer
safely break the cycle, and so the objects will remain alive even when
you can no longer reach them from your code.

So, in general, avoid the __del__ method unless you absolutely need it.
 
C

Chris Angelico

The __del__ method does not delete an object. Remember, objects are only
deleted when there are no references to it. Otherwise you could have some
code that tries to use a deleted object, and you would get a system crash
or BSOD.

There is a conceptually viable alternative: destroy an object
immediately and force all references to it to become some sentinel
value (eg None). Python currently doesn't have this, but it would be
rather convenient at times. Could be part of a construct like 'with'
to say "make this, use it, and then dispose of it".

ChrisA
 
M

Matteo Boscolo

from my gc.get_object()
I extract the sub system of the object that I would like to delete:

this is the object:
Class name
win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.ITDProperty
that is traked and the reference are:
get_referents >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>RefCount 5
<type 'tuple'> >>>> (<class win32com.client.DispatchBaseClass at
0x026ACB58>,)
RefCount 5
<type 'dict'> >>>> '__int__': <function __int__ at 0x03A50770>,
'__module__': 'win32com.gen_py.F45
RefCount 8
<type 'str'> >>>> ITDProperty
RefCount 9
<type 'function'> >>>> <function __getattr__ at 0x026C2630>
RefCount 9
RefCount 15
<type 'dict'> >>>> 'python_version': 34014192, 'defaultUnnamedArg':
<PyOleEmpty object at 0x00447E
RefCount 6
<type 'list'> >>>> <class
win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.I
RefCount 4
<type 'list'> >>>> (u'ItemsListCreator', u'trick', u'pVal'), (3, 49,
'0', None), (16393, 10, None,
RefCount 4
<type 'frame'> >>>> <frame object at 0x029721D8>
RefCount 7
<type 'frame'> >>>> <frame object at 0x02760148>
RefCount 5
<type 'dict'> >>>> '{39AAEA35-F71F-11D2-BD59-00500400405B}': <class
win32com.gen_py.F4503A16-F637-

how can I understand how to clean up this situation or were are the
references that I need to delete ?

From the cad non python script I call an in process python com object,
and before coming back to the cad application I need to clean up all com
reference, because if I do not do that I corrupt the cad application .

so I urgently need to clean up all reference before coming back to the
cad application.

any idea?

regards,
Matteo


Il 17/09/2012 18:09, Chris Angelico ha scritto:
 
O

Oscar Benjamin

from my gc.get_object()
I extract the sub system of the object that I would like to delete:

this is the object:
Class name
win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.ITDProperty
that is traked and the reference are:
get_referents >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>>
RefCount 5
<type 'tuple'> >>>> (<class win32com.client.DispatchBaseClass at
0x026ACB58>,)
RefCount 5
<type 'dict'> >>>> '__int__': <function __int__ at 0x03A50770>,
'__module__': 'win32com.gen_py.F45
RefCount 8
<type 'str'> >>>> ITDProperty
RefCount 9
<type 'function'> >>>> <function __getattr__ at 0x026C2630>
RefCount 9

RefCount 15
<type 'dict'> >>>> 'python_version': 34014192, 'defaultUnnamedArg':
<PyOleEmpty object at 0x00447E
RefCount 6
<type 'list'> >>>> <class
win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.I
RefCount 4
<type 'list'> >>>> (u'ItemsListCreator', u'trick', u'pVal'), (3, 49,
'0', None), (16393, 10, None,
RefCount 4
<type 'frame'> >>>> <frame object at 0x029721D8>
RefCount 7
<type 'frame'> >>>> <frame object at 0x02760148>
RefCount 5
<type 'dict'> >>>> '{39AAEA35-F71F-11D2-BD59-00500400405B}': <class
win32com.gen_py.F4503A16-F637-

how can I understand how to clean up this situation or were are the
references that I need to delete ?

From the cad non python script I call an in process python com object,
and before coming back to the cad application I need to clean up all com
reference, because if I do not do that I corrupt the cad application .

so I urgently need to clean up all reference before coming back to the
cad application.

any idea?

http://mg.pov.lt/objgraph/
http://mg.pov.lt/blog/hunting-python-memleaks.html

I have previously used the code from one of the links above to hunt down a
reference leak. It gives a graphical view of the alive references which helps
to locate the source of the ref leak.

Oscar
 
R

Robert Miles

It is becoming quite clear that some change has happened recently to
Google Groups that makes posts coming from there rather more obnoxious
than before. And there doesn't seem to be much its users can do except
use something else.

Using Google Groups for posting to Usenet has been a bad idea for a long
time, but now it just seems to be a sure recipe for annoying the rest of
us. Again, not something you have much control over, except to stop
using Google Groups.

Could this mean that Google wants all the spam posted through Google
Groups to look obnoxious to the rest of Usenet that the spammers will go
elsewhere?

Robert Miles
 
G

Grant Edwards

It is becoming quite clear that some change has happened recently to
Google Groups that makes posts coming from there rather more obnoxious
than before.

Well, that's certainly something of an accomplishment. I've become
somewhat suspicious that Google Groups is Google's deliberate attempt
to kill off Usenet and non-Google-controlled mailing lists. Nothing
can be that bad by accident. Except perhaps certain Microsoft
products.... make that most Microsoft products.
And there doesn't seem to be much its users can do except
use something else.

Using Google Groups for posting to Usenet has been a bad idea for a long
time, but now it just seems to be a sure recipe for annoying the rest of
us. Again, not something you have much control over, except to stop
using Google Groups.

I told my news client years ago to filter out anything posted from
Google Groups -- and I know I'm not alone. If one wants the best
chance of getting a question answered, using something other than
Google Groups is indeed a good idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top