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

Fix crashes and on Windows with files across multiple drives/paths #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarkSmithAU
Copy link

Fantastic IDE, thank you! :)

I have fixed some bugs found on Windows when working across different drives and paths. The program assumes the working directory will be on the same drive etc which makes the DownLoadAndRun functionality break (silently).

I have fixed this with a few small changes and it now works OK for me. After fixing this I found a few similar issues with the ctrl.py file where it had to strip off the drive letter properly otherwise it sent D:/ to micropython in run commands etc which failed.

These changes should work across *nix and Windows but I have only tested them on Windows.

Original error with prints on the input paths to show why it was breaking, with 'z' being the username:
pcOpenFile:D:/ds18b20test.py
convert D:/ds18b20test.py
0
ds18b20test.py
D:/ds18b20test.py
cmd=uitouart:::�
Traceback (most recent call last):
File "C:\gitsrc\uPyCraft_src\uPyCraft.py", line 1492, in slotDownloadFileAndRun
if self.slotDownloadFile():
File "C:\gitsrc\uPyCraft_src\uPyCraft.py", line 1479, in slotDownloadFile
myfile=open(str(rootDirectoryPath+afile[1:]),'w',encoding='utf-8')
OSError: [Errno 22] Invalid argument: 'C:/Users/z:/ds18b20test.py'
-1

Fantastic IDE, thank you! :)

I have fixed some bugs found on Windows when working across different drives and paths.  The program assumes the working directory will be on the same drive etc which makes the DownLoadAndRun functionality break (silently).

I have fixed this with a few small changes and it now works OK for me.  After fixing this I found a few similar issues with the ctrl.py file where it had to strip off the drive letter properly otherwise it sent D:/ to micropython in run commands etc which failed.

These changes should work across *nix and Windows but I have only tested them on Windows.

Original error with prints on the input paths to show why it was breaking, with 'z' being the username:
pcOpenFile:D:/ds18b20test.py
convert D:/ds18b20test.py
0
ds18b20test.py
D:/ds18b20test.py
cmd=uitouart:::�
Traceback (most recent call last):
  File "C:\gitsrc\uPyCraft_src\uPyCraft.py", line 1492, in slotDownloadFileAndRun
    if self.slotDownloadFile():
  File "C:\gitsrc\uPyCraft_src\uPyCraft.py", line 1479, in slotDownloadFile
    myfile=open(str(rootDirectoryPath+afile[1:]),'w',encoding='utf-8')
OSError: [Errno 22] Invalid argument: 'C:/Users/z:/ds18b20test.py'
-1
@jhlucky
Copy link

jhlucky commented May 3, 2018

@MarkSmithAU The latest version is compatible with Windows and Linux, but for the lack of consideration in logic, it will lead to errors in disks except the C disk. This problem will be solved in the further uPyCaft and will be released together with the MAC version. Thanks for your attention.

@jhlucky
Copy link

jhlucky commented May 3, 2018

@MarkSmithAU It caused by rootDirectoryPath.
linux: /home/user/
windows: C:\Users\Administrator
In windows, files in D disk or F disk ... filename not contains the rootDirectoryPath.lead to errors.
If you run in C disk,it's OK.

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

Successfully merging this pull request may close these issues.

2 participants