Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename_dirs_from_xmls fails because of illegal characters #70

Open
esturdivant-usgs opened this issue Jun 13, 2019 · 2 comments
Open

rename_dirs_from_xmls fails because of illegal characters #70

esturdivant-usgs opened this issue Jun 13, 2019 · 2 comments

Comments

@esturdivant-usgs
Copy link
Owner

When running on the Windows, os.rename throws OSError with illegal characters. Here it was caused by a line break (\n).

Error report:

Traceback (most recent call last):
  File "sb_automation.py", line 92, in <module>
    rename_dirs_from_xmls(parentdir)
  File "C:\Users\emontgomery\python_progs\science-base-automation\autoSB.py", line 544, in rename_dirs_from_xmls
    os.rename(datadir, os.path.join(basedir, data_title))
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'D:\\sandwich2016' -> 'D:\\Geotagged Low-Altitude Aerial Imagery From Unmanned Aerial Systems Flights Over Town Neck Beach, in Sandwich, Massachusetts, on March 30, 2016\n        '
@esturdivant-usgs
Copy link
Owner Author

Added a stop-gap fix in commit 8f0df01

@esturdivant-usgs
Copy link
Owner Author

from Ellyn:

I put the closing title tag on the same line, so there's no \n, yet it's still choking in a similar way:

(sb_py3) C:\Users\emontgomery\python_progs\science-base-automation>python sb_automation.py
ScienceBase password:
Traceback (most recent call last):
  File "sb_automation.py", line 92, in <module>
    rename_dirs_from_xmls(parentdir)
  File "C:\Users\emontgomery\python_progs\science-base-automation\autoSB.py", line 545, in rename_dirs_from_xmls
    os.rename(datadir, os.path.join(basedir, data_title))
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:\\sandwich2016_forSB\\gcp' -> 'D:\\sandwich2016_forSB\\ Surveyed Positions of Ground Control Points Associated With Images Collected During Unmanned Aerial Systems Flights Over Town Neck Beach, in Sandwich, Massachusetts on January 22, January 25, February 11, March 30, and September 21, 2016'

At least now it's in a sub dir when it fails... It seems to have the 'gcp' to the left of the ->, but has lost the 'gcp' at the right, so no wonder it can't find the path. Looks like it's not assembling the path_with_subdir correctly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant