apply_patch not working | v0.1.2504161510

Resolved 💬 3 comments Opened Apr 17, 2025 by notlikejuice Closed May 17, 2025

OpenAI Codex (research preview) v0.1.2504161510
localhost session: ddb05b9d3997420f82ec49991151a6b0
approval: suggest

I have WSL2 with Ubuntu 22.04, I also downloaded zsh because that's what chatgpt advised me about apply_patch not working - but unfortunately it still has problems implementing it. What can I do about this?

` command

$ apply_patch << 'EOF'
* Begin Patch
* Add File: main.py
+from models.video import Video
+from models.stats import VideoStats
+from services.research import research_topic
+from services.script_generator import generate_script
+from services.stats_analyzer import analyze
+
+def main():

  • # Sample usage of the assistant modules
  • video = Video(
  • id="vid123",
  • title="Sample Video",
  • description="A brief description of the video.",
  • duration_seconds=300,
  • tags=["sample", "test"]
  • )
  • research_points = research_topic("video creation tips")
  • script = generate_script(video, research_points)
  • print("Generated Script:")
  • print(script)

+

  • stats = VideoStats(views=1000, likes=100, comments=50)
  • insights = analyze(stats)
  • print("Stats Insights:", insights)

+
+if __name__ == "__main__":

  • main()

*** End Patch
EOF

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│Shell Command │
│ │
│$ apply_patch << 'EOF' │
│* Begin Patch │
│
* Add File: main.py │
│+from models.video import Video │
│+from models.stats import VideoStats │
│+from services.research import research_topic │
│+from services.script_generator import generate_script │
│+from services.stats_analyzer import analyze │
│+ │
│+def main(): │
│+ # Sample usage of the assistant modules │
│+ video = Video( │
│+ id="vid123", │
│+ title="Sample Video", │
│+ description="A brief description of the video.", │
│+ duration_seconds=300, │
│+ tags=["sample", "test"] │
│+ ) │
│+ research_points = research_topic("video creation tips") │
│+ script = generate_script(video, research_points) │
│+ print("Generated Script:") │
│+ print(script) │
│+ │
│+ stats = VideoStats(views=1000, likes=100, comments=50) │
│+ insights = analyze(stats) │
│+ print("Stats Insights:", insights) │
│+ │
│+if __name__ == "__main__": │
│+ main() │
│*** End Patch │
│EOF │
│ │
│Allow command? │

command.stdout (code: 127, duration: 0.6s)

bash: line 1: apply_patch: command not found`

View original on GitHub ↗

3 Comments

thekevs · 1 year ago

@notlikejuice As temporary fix, I created a soft link to the patch binary and it worked for me

sudo ln -s /usr/bin/patch /usr/bin/apply_patch
notlikejuice · 1 year ago

I appreciate the assistance. Occasionally, the issue is resolved; however, at times, the issue persists. More often than not, the issue is resolved after reinstalling WSL, after which another occurrence of the same error occurs after three or four attempts.

marcoscale98 · 1 year ago

I continue to have the same issue