"Rayon" wrote
I am running cherrypy server but I am having some trouble with sessions
We need something a bit more specific.
What kind if "trouble"?
Does it execute but with the wrong result? (In what way wrong?)
Does it execute with errors? (please include error text)
Does it fail to exec
I am running cherrypy server but I am having some trouble with sessions
Where is my code
from cherrypy.lib import sessions
sess = sessions.Session()
x = sess.id
return x;
___
Tutor maillist - Tutor@python.org
To unsubscribe o
Modulok, 13.04.2010 16:52:
... generate pretty little web pages ...
Note that the 'pretty' bit usually doesn't reside in HTML but in CSS.
Stefan
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pytho
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
: Is there an easy way to get a docstring from a python file,
: without first importing it?
:
: Basically, I'm trying to read python code examples from files on
: disk and generate pretty little web pages from them. I invision
: the d
Is there an easy way to get a docstring from a python file, without
first importing it?
Basically, I'm trying to read python code examples from files on disk
and generate pretty little web pages from them. I invision the
docstring appearing as the main text on the page, with the rest of the
code i
> Actual the first item in the tuple (returned by os.walk) is singular (a
> string), so I might call it rootDir. Only the other two needed to be
> changed to plural to indicate that they were lists.
I did discover this, too. I wanted to finish with the code at hand
before I started experimenting
Dotan Cohen wrote:
Here is the revised version:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
currentDir = os.getcwd()
i = 1
filesList = os.walk(currentDir)
for rootDirs, folders, files in filesList:
Actual the first item in the tuple (returned by os.walk) is singular (a
string), so I
Here is the revised version:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
currentDir = os.getcwd()
i = 1
filesList = os.walk(currentDir)
for rootDirs, folders, files in filesList:
for f in files:
if (rootDirs!=currentDir):
toMove = os.path.join(rootDirs, f)
> I would add a few different features to this 'find' to make it a bit
> more resistant to failure, although this sort of solution is always
> subject to the "somebody else is toying with my filesystem race
> condition".
>
> find "$srcdir" -depth -type f -print0 \
> | xargs --null --no-run-if-e
>> I use this one-liner for moving photos nested a single folder deep
>> into the top-level folder:
>> find * -name "*.jpg" | awk -F/ '{print "mv "$0,$1"-"$2}' | sh
>
> You could miss out the awk and use the exec option of find...
>
> Or miss out the shell and use the system() function of awk.
>
>> When combining directory paths, it's generally safer to use
>>
>> os.path.join()
>
> As KDE/Dolphin runs on windows this is even more important as it will
> sort out the directory separator (/ vs \) for you.
>
Added, thanks!
> Some added reading on os.path can be found on Doug's excellent PyMO
Thanks.
2010/4/13 Joson
> thanks a lot. you've saved my life...
>
> 2010/4/10 Chris Fuller
>
>
>> I'm using Debian. Used to be etch, but I did a double dist-upgrade
>> recently.
>> So, whatever the current testing release is. My shell is zsh, but bash
>> should
>> work the same.
>>
>> PYTHONP
All right, I've got it! This script will move all files of
subdirectories into cwd.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
currentDir = os.getcwd()
filesList = os.walk(currentDir)
for rootDirs, folders, files in filesList:
for f in files:
toMove = os.path.join(rootDir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
: I use this one-liner for moving photos nested a single folder deep
: into the top-level folder:
:
: find * -name "*.jpg" | awk -F/ '{print "mv "$0,$1"-"$2}' | sh
I would add a few different features to this 'find' to make it a bit
more
> Why is the print below commented out?
>>
>> for f in file:
>> toMove =oot + "/" + f
>> #print toMove
>> os.rename(toMove, currentDir)
>>
I was testing, and it was not longer needed. It was returning what I
expected. Note that print can only be used to test that the value
>> I see, thanks. So I was sending it four values apparently. I did not
>> understand the error message.
>
> No, you're sending it two values: a tuple, and a string. It wants two
> strings. Thus the error. If you had sent it four values, you'd have gotten
> a different error.
I see. For some re
> from the docs:
> os.rename(src, dst)¶Rename the file or directory src to dst. If dst is a
> directory, OSError will be raised.
I did read that, thank you. That is why I asked how to override, as I
understood that Python was functioning exactly as intended.
> It seems what you wan to
> do is os
17 matches
Mail list logo