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

Broken windows paths on linux #30

Open
lissyx opened this issue May 31, 2022 · 1 comment
Open

Broken windows paths on linux #30

lissyx opened this issue May 31, 2022 · 1 comment

Comments

@lissyx
Copy link

lissyx commented May 31, 2022

$ poetry run python generate_side_by_side.py --base-revision 338c1afa163526b8aab61dcddcb44db70130e2af --base-branch mozilla-central --new-revision 773bf7a99888344d3d86629248e2b76cebf8583f --new-branch try --test-name browsertime-tp6-firefox-espn-fis-e10s --platform test-windows10-64-shippable-qr --cold --overwrite --output bug1769903_run_utility_rdd_together/`
[...]
Traceback (most recent call last):
  File "/home/alex/codaz/Mozilla/mozperftest-tools/generate_side_by_side.py", line 897, in <module>
    cold_pairing = find_closest_videos(
  File "/home/alex/codaz/Mozilla/mozperftest-tools/generate_side_by_side.py", line 565, in find_closest_videos
    shutil.copyfile(newvid, newvidnewpath)
  File "/usr/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'bug1769903_run_utility_rdd_together/AC0gqpYlTWuscirNFiZXMg/1/browsertime-tp6-firefox-espn-fis-e10s/browsertime-results_data/0/euwQFWpwTACT_browsertime-results/espn/pages\\www_espn_com\\nba\\story\\_\\page\\allstarweekend25788027\\the-comparison-lebron-james-michael-jordan-their-own-words\\cold\\data\\video\\2.mp4'

The path itself is good, but it's Windows-formatted:

$ echo "bug1769903_run_utility_rdd_together/AC0gqpYlTWuscirNFiZXMg/1/browsertime-tp6-firefox-espn-fis-e10s/browsertime-results_data/0/euwQFWpwTACT_browsertime-results/espn/pages\\www_espn_com\\nba\\story\\_\\page\\allstarweekend25788027\\the-comparison-lebron-james-michael-jordan-their-own-words\\cold\\data\\video\\2.mp4" | sed -e 's/\\/\//g'
bug1769903_run_utility_rdd_together/AC0gqpYlTWuscirNFiZXMg/1/browsertime-tp6-firefox-espn-fis-e10s/browsertime-results_data/0/euwQFWpwTACT_browsertime-results/espn/pages/www_espn_com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words/cold/data/video/2.mp4
$ ll bug1769903_run_utility_rdd_together/AC0gqpYlTWuscirNFiZXMg/1/browsertime-tp6-firefox-espn-fis-e10s/browsertime-results_data/0/euwQFWpwTACT_browsertime-results/espn/pages/www_espn_com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words/cold/data/video/2.mp4
-rw-rw-rw- 1 alex alex 200K mai   31 22:19 bug1769903_run_utility_rdd_together/AC0gqpYlTWuscirNFiZXMg/1/browsertime-tp6-firefox-espn-fis-e10s/browsertime-results_data/0/euwQFWpwTACT_browsertime-results/espn/pages/www_espn_com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words/cold/data/video/2.mp4
@lissyx
Copy link
Author

lissyx commented Jun 1, 2022

diff --git a/generate_side_by_side.py b/generate_side_by_side.py
index 038376f..5a0c258 100644
--- a/generate_side_by_side.py
+++ b/generate_side_by_side.py
@@ -226,11 +226,19 @@ def find_videos(artifact_dir, original=False):
     with warm_path.open() as f:
         warm_data = json.load(f)

+    def read_path(p, f):
+        rv = None
+        if "\\" in f:
+            rv = pathlib.PureWindowsPath(p.parents[0], f).as_posix()
+        else:
+            rv = pathlib.Path(p.parents[0], f)
+        return rv
+
     return {
         "cold": [
-            str(pathlib.Path(cold_path.parents[0], file)).replace(".mp4", "-original.mp4")
+            str(read_path(cold_path, file)).replace(".mp4", "-original.mp4")
             if original
-            else str(pathlib.Path(cold_path.parents[0], file))
+            else str(read_path(cold_path, file))
             for file in cold_data[0]["files"]["video"]
         ],
         "warm": [

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