Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wtlib
WindEnergyToolbox
Commits
0fe81d25
Commit
0fe81d25
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
revert to old unix path method
parent
4223cc4a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/hawc2/htc_file.py
+2
-2
2 additions, 2 deletions
wetb/hawc2/htc_file.py
wetb/utils/cluster_tools/cluster_resource.py
+13
-12
13 additions, 12 deletions
wetb/utils/cluster_tools/cluster_resource.py
with
15 additions
and
14 deletions
wetb/hawc2/htc_file.py
+
2
−
2
View file @
0fe81d25
...
@@ -14,7 +14,7 @@ from io import open
...
@@ -14,7 +14,7 @@ from io import open
from
builtins
import
str
from
builtins
import
str
from
future
import
standard_library
from
future
import
standard_library
from
wetb.utils.process_exec
import
pexec
from
wetb.utils.process_exec
import
pexec
from
wetb.utils.cluster_tools.cluster_resource
import
unix_path
from
wetb.utils.cluster_tools.cluster_resource
import
unix_path
,
unix_path_old
standard_library
.
install_aliases
()
standard_library
.
install_aliases
()
from
collections
import
OrderedDict
from
collections
import
OrderedDict
...
@@ -104,7 +104,7 @@ class HTCFile(HTCContents, HTCDefaults):
...
@@ -104,7 +104,7 @@ class HTCFile(HTCContents, HTCDefaults):
def
readfilelines
(
self
,
filename
):
def
readfilelines
(
self
,
filename
):
with
open
(
unix_path
(
filename
),
encoding
=
'
cp1252
'
)
as
fid
:
with
open
(
unix_path
_old
(
filename
),
encoding
=
'
cp1252
'
)
as
fid
:
lines
=
list
(
fid
.
readlines
())
lines
=
list
(
fid
.
readlines
())
if
lines
[
0
].
encode
().
startswith
(
b
'
\xc3\xaf\xc2\xbb\xc2\xbf
'
):
if
lines
[
0
].
encode
().
startswith
(
b
'
\xc3\xaf\xc2\xbb\xc2\xbf
'
):
lines
[
0
]
=
lines
[
0
][
3
:]
lines
[
0
]
=
lines
[
0
][
3
:]
...
...
This diff is collapsed.
Click to expand it.
wetb/utils/cluster_tools/cluster_resource.py
+
13
−
12
View file @
0fe81d25
...
@@ -42,18 +42,19 @@ def unix_path(path, cwd=None, fail_on_missing=False):
...
@@ -42,18 +42,19 @@ def unix_path(path, cwd=None, fail_on_missing=False):
path
+=
"
/
"
path
+=
"
/
"
return
path
.
replace
(
"
\\
"
,
"
/
"
)
return
path
.
replace
(
"
\\
"
,
"
/
"
)
# filename = os.path.realpath(filename.replace("\\", "/")).replace("\\", "/")
def
unix_path_old
(
filename
):
# ufn, rest = os.path.splitdrive(filename)
filename
=
os
.
path
.
realpath
(
filename
.
replace
(
"
\\
"
,
"
/
"
)).
replace
(
"
\\
"
,
"
/
"
)
# ufn += "/"
ufn
,
rest
=
os
.
path
.
splitdrive
(
filename
)
# for f in rest[1:].split("/"):
ufn
+=
"
/
"
# f_lst = [f_ for f_ in os.listdir(ufn) if f_.lower() == f.lower()]
for
f
in
rest
[
1
:].
split
(
"
/
"
):
# if len(f_lst) > 1:
f_lst
=
[
f_
for
f_
in
os
.
listdir
(
ufn
)
if
f_
.
lower
()
==
f
.
lower
()]
# f_lst = [f_ for f_ in f_lst if f_ == f]
if
len
(
f_lst
)
>
1
:
# elif len(f_lst) == 0:
f_lst
=
[
f_
for
f_
in
f_lst
if
f_
==
f
]
# raise IOError("'%s' not found in '%s'" % (f, ufn))
elif
len
(
f_lst
)
==
0
:
# else: # one match found
raise
IOError
(
"'
%s
'
not found in
'
%s
'"
%
(
f
,
ufn
))
# ufn = os.path.join(ufn, f_lst[0])
else
:
# one match found
# return ufn.replace("\\", "/")
ufn
=
os
.
path
.
join
(
ufn
,
f_lst
[
0
])
return
ufn
.
replace
(
"
\\
"
,
"
/
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment