Re: Noob | datetime question

2006-11-14 Thread Kevin Kelley
import timeFORMAT='%Y%m%d'time.strftime(FORMAT,time.gmtime(time.time()+8380800))output = '20070219'--Kevin KelleyOn 11/14/06, Demel, Jeff
 <[EMAIL PROTECTED]> wrote:
I'm having trouble finding exactly what I need by googling, so thoughtI'd try to get a quick answer from the group.  This seems like somethingthat should be dead simple.I need to generate a string value of a date in the format MMDD that
is 97 days in the future.  The datetime module is brand new to me, andI'm not sure how to do this.  Can someone help me out here?TIA-JeffThis email is intended only for the individual or entity to which it is addressed.  This email may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or any attachments by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you are not the intended recipient of this message or the employee or agent responsible for delivery of this email to the intended recipient, please notify the sender by replying to this message and then delete it from your system.  Any use, dissemination, distribution, or reproduction of this message by unintended recipients is strictly prohibited and may be unla!
 wful.
--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Cloning" file attributes and permissions

2007-04-12 Thread Kevin Kelley

The os module has this ability:
http://docs.python.org/lib/os-file-dir.html

--
Kevin Kelley

On 4/12/07, Paulo da Silva <[EMAIL PROTECTED]> wrote:


Hi!

I need to process a file to produce another file that *must* have
*exactly* the same attributes and permissions of the former. What is the
best way to do this? The file must not exist with contents (it may exist
empty) unless it has the same attributes and permissions.
I know how to do this using, let me call it, "C type code" (stat, chmod,
chown, etc). I would like to hear some opinions on if and how it would
be possible in a more elegant/python way.

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

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

Re: "Cloning" file attributes and permissions

2007-04-13 Thread Kevin Kelley

If you know what the permissions are going to be then you can use umask to
set the default file creation permissions to match. Then any files created
in that directory will have the correct permissions.

I think the "pythonic" way to solve this problem would be to code up your
own module which handles all the dirty parts in the background. It would
create the new file, stat the original, and chmod/chown the new file as
needed to match the original. All you would have to do after creating the
module is pass the new function the original and new file information.

--
Kevin Kelley

On 4/12/07, Paulo da Silva <[EMAIL PROTECTED]> wrote:


[EMAIL PROTECTED] escreveu:
> On Apr 12, 5:19 pm, [EMAIL PROTECTED] wrote:
>> On Apr 12, 4:09 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote:
>>
...
>
> After poking around a bit I also discovered the
> shutil module.  It looks like you can use
> shutil.copy2.  More Pythonic, yes?
>


I have seen that in the index but I thought it was a different thing
because it was referenced as "high-level operations".
Anyway that helps but I still need to copy the whole file or to use stat
and chown for the user/group ids.

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

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

Re: "Cloning" file attributes and permissions

2007-04-13 Thread Kevin Kelley

This is what I (just now) put together as an example:

from os import stat,mknod,chown

def match_perms(org_fname,new_fname):
   # Get information on old file
   st = stat(org_fname)
   st_mode = st.st_mode
   st_uid = st.st_uid
   st_gid = st.st_gid

   # Create the new file
   mknod(new_fname,st_mode)

   # Matching permissions
   chown(new_fname,st_uid,st_gid)

if __name__ == "__main__":
   match_perms('old_filename','new_filename')

On 4/13/07, Kevin Kelley <[EMAIL PROTECTED]> wrote:


If you know what the permissions are going to be then you can use umask to
set the default file creation permissions to match. Then any files created
in that directory will have the correct permissions.

I think the "pythonic" way to solve this problem would be to code up your
own module which handles all the dirty parts in the background. It would
create the new file, stat the original, and chmod/chown the new file as
needed to match the original. All you would have to do after creating the
module is pass the new function the original and new file information.

--
Kevin Kelley

On 4/12/07, Paulo da Silva <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] escreveu:
> > On Apr 12, 5:19 pm, [EMAIL PROTECTED] wrote:
> >> On Apr 12, 4:09 pm, Paulo da Silva <[EMAIL PROTECTED] >
> wrote:
> >>
> ...
> >
> > After poking around a bit I also discovered the
> > shutil module.  It looks like you can use
> > shutil.copy2.  More Pythonic, yes?
> >
>
>
> I have seen that in the index but I thought it was a different thing
> because it was referenced as "high-level operations".
> Anyway that helps but I still need to copy the whole file or to use stat
> and chown for the user/group ids.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


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

2007 DST Changes

2007-01-23 Thread Kevin Kelley

Is python affected by the 2007 DST changes in the US? Other than making sure
the OS is patched correctly (Win 2K and Solaris 8) is there anything else
that needs to be done from a Python point of view?

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

Re: File paths printed in stack trace are where Python was built???

2008-11-28 Thread Kevin Kelley
Actually, if you to get an error from a module built with zipimport it
points to where that module was built as well.

Kevin

On Fri, Nov 28, 2008 at 9:22 PM, Roy Smith <[EMAIL PROTECTED]> wrote:

> We distribute Python internally by building it in one place, and then
> distributing images of the entire install area to wherever it's
> needed.  I just noticed something strange; when I got an error which
> caused a stack trace, the file paths in the printed stack trace refer
> to the directory where Python was built.
>
> Why is this?  All other paths I can think of in Python are generated
> relative to where the binary is running, not where it was built.  Is
> there a way to make the stacktraces point to where Python is running
> from, instead of where it was built?
>
>
> Traceback (most recent call last):
>  File "tProcess.py", line 27, in test_t1
>   server = subprocess.Popen(argv)
>  File "/emc/chacoj2/src/clean/smarts/thirdparty/python/2.5.1/
> linux_rhAS40-x86-32/install/lib/python2.5/subprocess.py", line 593, in
> __init__
>   errread, errwrite)
>  File "/emc/chacoj2/src/clean/smarts/thirdparty/python/2.5.1/
> linux_rhAS40-x86-32/install/lib/python2.5/subprocess.py", line 1079,
> in _execute_child
>   raise child_exception
> AttributeError: 'list' object has no attribute 'rfind'
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: noob needs help

2008-11-30 Thread Kevin Kelley
Try "python documents/helloworld.py" or "cd documents" before "python
helloworld.py".
Kevin

On Sun, Nov 30, 2008 at 11:50 AM, toveysnake <[EMAIL PROTECTED]> wrote:

> I decided that I want to learn python, and have no previous
> programming experience. I was reading the guide A byte of python and
> got to the part where you create and run the program helloworld.py I
> used kate to create this program and save it as helloworld.py. I then
> entered the command python helloworld.py into the terminal(I am using
> ubuntu 8.10) and I get this error:
>
> [EMAIL PROTECTED]:~$ python helloworld.py
> python: can't open file 'helloworld.py': [Errno 2] No such file or
> directory
>
> Am I saving the file in the wrong spot?(I saved it in documents)
> Should I use a different editor? Is there a better python book
> available online?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread Kevin Kelley
If they are running standard Win XP (Home or Pro), as opposed to 64-bit Win
XP, then whether or not the CPU supports the IA64 instruction set really
doesn't matter. As far as I know every Intel Core2 and Pentium Dual-Core CPU
since ~ 2006 has supported 64bit instructions, even the Atom is 64bit. Also,
the "R" is for Registered Trademark (of Pentium), it's not part of the
name/model (http://ark.intel.com/cpu.aspx?groupId=33925).

Kevin

On Fri, Dec 5, 2008 at 2:02 PM, jim-on-linux <[EMAIL PROTECTED]> wrote:

> Python help,
>
> In September I wrote:
> I have a number of clients running a program built
> with python 2.5.  One has just purchased an HP with
> a duo core Pentium R processor E2200,  2.2G with .99g
> ram.
>
> Only on the new HP, when they try to print they get an
> import error;
> File win32ui.pyc line 12, in 
> File win32ui.pyc, line 10, in _load
> ImportError: DLL load failed:  The specified module
> could not be found.
>
> It turns out that the E2200 processor is 64 bit
> architecture.
>
> What are my options?
>
> I've run DependecyWalker,
> They are using Win XP Service Pack 2
>
>
>
> jim=on-linux
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Kevin Kelley
Python has it's place, usually getting things done, rather than being
flashy.

For example, while Java is still the "Enterprise King", both the leading
application servers (Weblogic and Websphere) adopted Jython as their
internal scripting language last year (or was it 2006?).

It's used heavily for internal game scripting (Eve Online uses it very
heavily (specifically Stackless), as does BF 2142).

I don't know if in fact Python is the 3rd most popular language, but I would
not be surprised by it passing up other high level scripting languages like
Perl and Ruby.

Kevin

On Mon, Dec 22, 2008 at 9:11 AM, walterbyrd  wrote:

> I have read that python is the world's 3rd most popular language, and
> that python has surpassed perl in popularity, but I am not seeing it.
>
> >From what I have seen:
>
> - in unix/linux sysadmin, perl is far more popular than python,
> windows sysadmins typically don't use either.
> - in web-development, php is far more popular than python - it's not
> even close.
> - when I did a search on dice, I found over 20X more jobs advertised
> for ruby on rails developers, than for python dango developers.
> - application development is dominated by java, c/c++, and maybe a
> little visual basic.
> - as I understand it, fortran is still the most popular language for
> numberical programming.
>
> Of course, these are just observations on my part, nothing scientific
> about it. But, I can't help but wonder how python's popularity was
> determined. I suspect that a lot of people use python as a secondary
> skill. For example, I use ms-word, but I'm not an ms-word
> professional.
>
> Please note: I am not confusing popularity with quality. I am not
> saying that php is better for web-dev, or anything like that. I am
> just wondering how python is rated as being so popular, when python
> does not seem to dominate anything.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-24 Thread Kevin Kelley
On Tue, Dec 23, 2008 at 10:38 AM, r  wrote:

>
> School time son,
> This forum is much more than a question answer session, son. Sure
> people are welcome to ask a Python related question. But this forum is
> really the main highway of Python development and future. If your a
> n00b go to the "Python forum.org", you will feel more comfy over
> there.
>
>
>From python.org (http://www.python.org/community/lists/) -

python-list:
Pretty much anything Python-related is fair game for discussion, and the
group is even fairly tolerant of off-topic digressions; there have been
entertaining discussions of topics such as floating point, good software
design, and other programming languages such as Lisp and Forth.

*Most discussion on comp.lang.python is about developing with Python, not
about development of the Python interpreter itself.*

python-dev:
Note: python-dev is for work on developing Python (fixing bugs and adding
new features to Python itself); if you're having problems writing a Python
program, please post to comp.lang.python.

*python-dev is the heart of Python's development. Practically everyone with
Subversion write privileges is on python-dev, and first drafts of PEPs are
often posted here for initial review and rewriting before their more public
appearance on python-announce.*

I think you are confusing lists r.

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