files,folders,paths

ecu_jon hayesjdno3 at yahoo.com
Mon Feb 14 04:52:25 CET 2011


On Feb 13, 8:29 pm, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> ecu_jon <hayesjd... at yahoo.com> writes:
> > here take a look.
> >http://thanksforallthefish.endofinternet.net/testing.py
>
> I think you're confusing yourself by shoving lots of experimental lines
> into a large program and not isolating the problem. I see that you are
> trying lots of different ways of doing the same thing, and commenting
> some lines out arbitrarily.
>
> Instead, focus on the issue that's causing you confusion: constructing a
> filesystem path and testing whether it exists.
>
> Make a *minimal* program that shows the problem you're having. Post it
> *here* (that's why it's important that it be minimal), along with the
> exact error traceback you get from Python when you run it.
>
> Once you have something minimal that we, too, can run, we can comment
> better on its behaviour.
>
> --
>  \        “Members of the general public commonly find copyright rules |
>   `\        implausible, and simply disbelieve them.” —Jessica Litman, |
> _o__)                                              _Digital Copyright_ |
> Ben Finney

this thing evolved i piece a a time. i got help from the wxpython
people, and now that code has been stable for weeks.

the function weekChoice came after talking to 2 CS grad studenst for 2
hours. deciding how to decide what week to pick. it seems to be solid.
was picking week 1 up till 12:02 when i tested it on the 8th, then
went to week 2.

getusername probably should be unfunctionalized, and maybe dropped
completely.

homeDir is good on the 3 differnt platforms i have tested it on,
linux, xp and 7. Ubuntu returned /home/name, 7 returned c:\Users\name
\, xp returned c:\docs and settings\name\app data\ or something close
to that.

in version 011, source1 and destination1 worked fine. selectivly
coping files or folders as needed.

backupall has been volatile, but relatively stable last 2 weeks. in
version 011, it does the if not folder and file detection. in version
12a, it does not. all of the functions cascade so im not really sure
how i could cut something out, with out serious rewrite. i already did
shrink it by gutting the wxpython parts. after uncommenting the 2
lines
shutil.copytree(os.getcwd(), destination+leftover)
shutil.copy2(filesource, filedest1)
i get this as an traceback
folder to copy =  \\\\Mothera\\jon\week2

Traceback (most recent call last):
  File "I:\college\spring11\capstone-project\testing.py", line 86, in
<module>
    backupall()
  File "I:\college\spring11\capstone-project\testing.py", line 73, in
backupall
    shutil.copytree(os.getcwd(), destination+leftover)
  File "C:\Python27\lib\shutil.py", line 174, in copytree
    os.makedirs(dst)
  File "C:\Python27\lib\os.py", line 150, in makedirs
    makedirs(head, mode)
  File "C:\Python27\lib\os.py", line 150, in makedirs
    makedirs(head, mode)
  File "C:\Python27\lib\os.py", line 150, in makedirs
    makedirs(head, mode)
  File "C:\Python27\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 161] The specified path is invalid: '\\\\\\\\'



More information about the Python-list mailing list