Forums

Editor - trouble opening a file for editing

Hi guys,

I'm having some perplexing difficulty with the PA IDE editor:

  • I've created a text file containing some XML using the editor;
  • It has been saved as an '.xml' file; and
  • I now can't re-open the file for editing by clicking on the file in the file manager (strictly speaking, I guess this may be a "file manager" problem then).

I thought that changing the file suffix might make a difference, but no matter what I change it it (.html, .py, etc) I still can't open it through the file manager. Permissions are the same as for every other file. Since there's no way to open a file (that I'm aware of) in the editor, this basically means I can't edit my file.

Any idea what may be causing this, or any workaround suggestions?

Geoff

Maybe try downloading it to your local machine and then upload it again? (using the Files tab)

What happens if you try to list it in a Bash shell?

Jim

Downloaded, deleted and re-uploaded; still can't open the editor from the file manager for that file. The file CATs fine in Bash.

Geoff

@Geoff

For what it's worth, I just repeated your steps with a few lines of XML with no probs.

Have you tried a different file name? (apart from different extensions)

What happens if you copy it to a different folder?

Have you tried logging out and in again?

soz - g2g now (as my daughter would say...)

Jim

What happens when you try to edit the file?

I can edit the file in the console (through vi, etc), but I can't open the file in the IDE editor because it isn't highlighted as a link in the file manager.

G

That's really weird. Do you mind doing a little testing so we can track down the problem? If so, try: 1. Create a file with the same name as the one that's giving you trouble, but leave it empty. Go back to the directory listing and see if you can edit it. 2. If you can edit it, copy the URL of the edit page to somewhere safe. 3. Now put the contents of the original file in, save it and go back to the directory listing to see if the filename is a link. 4. If it isn't, use the URL from step 2 and see if you get the editor or an error.

Interesting one!

@geoffham Have you tried a different browser - which one are you using?)

Have you tried a different machine - what one are you using?

I think personally I'd do a 'View Page Source' (Firefox) or equivalent in your browser. For each of your files you should see something like:

<tr class="hoverable" id="id_row_file_11">
    <td class="first_column">
        <a href="/user/jgmdavies/files/home/jgmdavies/test.xml?edit"><i class="icon-file pale"></i> test.xml</a>
    </td>

What do you see?

Interestingly, just above this the Firefox 'View Page Source' shows a <div> in red because it's inside a table. You can have <div>s in a <table> if they're inside a <tr> or <td>, but these divs are between rows - are you using very strict browser settings perhaps?

Jim

good spot Jim. I don't think there's any good reason those divs are between TD's, i'm going to see if i can pop them somewhere sensible quickly...

but, as you say, it seems really unlikely that it would have anything to do with this problem...

Thanks Harry.

They're between TRs, by the way! ;---)

:-P

they're between tds as well, it's just that the tds they're between are themselves in trs, so there are some tr or /tr tags in between the tds that they're in between, so they're both between trs and between tds, and between tr tags between td tags. except that they won't be as soon as i've done this commit, then they'll just be inside tds inside trs....

Got it!

Curious to see how Geoff is getting on - I guess he's on a Mac, so no chance of reproducing the problem here... ;-------)

Hi guys,

Most bizarre - now I can create a file with the same name that I can open for editing without any difficulty, but the original file (and the copy of it I created with an .xml extension) still can't be opened. Here's how the source around that file name looks:

<tr class="hoverable" id="id_row_file_21">
   <td class="first_column">
   <i class="icon-file pale"></i> twilioTools.xml
   </td>

Whereas functioning linked documents look like:

 <tr class="hoverable" id="id_row_file_10">
    <td class="first_column">
       <a href="/user/geoffham/files/home/geoffham/estore/locatron.html?edit"><i class="icon-file pale"></i> locatron.html</a>
    </td>

Seems like a one-off problem that I can work around, but just wanted to check to see if anyone else was having that issue.

G

Can you edit a file the has the same content as your original file but is named something completely different?

Ah - that's done it! The answer is no, although the file is just plain-jane XML. For the record, here are the contents:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
{% if responseType == 'call' %}
    <Say>You have reached the Equatoria Forestry Group. Please leave a message and someone will return your call shortly.</Say>
    <Record maxLength="30" action="recordingReceived/" />
{% endif %}
{% if responseType == 'text' %}
    <Sms from="{{ from_number }}" to="{{ to_number }}">From {{ request.REQUEST.From }}: {{ request.REQUEST.Body }}</Sms>
{% endif %}
</Response>

G

Confirmed! I have a number of XML files in various folders, and personally I don't use the XML declaration (header) line unless I have to, and never yet on PA.

I can 'break' my old XML files, as per Geoff's experience, by adding just the following as line 1:

<?xml version="1.0"?>

Geoff - can you possibly manage without the XML declaration lines, i.e. does your software actually need them?

Jim

I'll survive. In fact, I'm done editing that file - I more just wanted to flag the weird behaviour.

G

That's interesting. I'll have a poke around the code on Monday and see if I can work out what's going on. Thanks for the diagnostic work.

I have the same problem. I cannot re-open any file with .py extension. I am running a mac, tried on Chrome and Firefox. I can create a new file name.py, it runs successfully. I can upload a file but since I cannot open it, cannot run it (is there a way? did not find it) I can re-open files with csv extension (created online or uploaded), with .txt as well as all .files that are inserted automatically. In the bash console, I can open the file with vi (but this is not an option!!!!). The html source code looks the same as above. Any way around? thanks! I am exploring if I will suggest PA to my beginner students in Python for collaborative purpose essentially.

Can I have permission to look at your files?

I want to up vote fixing this. I am using a platform that requires XML declarations at the top of files. I'm getting better editing them through VIM, but using the browser IDE would sure be nice.

Sure, I've added that to our task-tracker. It looks like it's a reasonably easy fix, we just need to allow editing of files that we identify as "application/xml".

Thanks! That would be great.

I'm having the same problem now, though xml isn't the cause. Can't open app.py, nor downloaded and re-uploaded file, nor new file created at pythonanywhere with code pasted in. You definitely have permission to look at my files - any help would be appreciated.

There's a strange character in your file. It looks like ^A at the end of the comment line "#first get db object" when I look at the file in a console. It's making the system detect the file as a binary and so it can't be edited. When I removed it, the file showed up as editable in the interface.

Great, thanks!

Any update on this?

I'm having the same problem trying to edit an SVG file

Hi there,

This is because we currently don't recognised SVG files as being editable. We will have to add "application/svg+xml" to the mimetypes that we recognise. In the meantime, you could use the bash console to navigate to the file and edit the file in vim/emacs etc.

I have this problem often if a program I run on PA creates the file. Perhaps it's permissions thing, though I can't imagine why not allowing site-owners to look at files made by their own programs would be needed.

We use the permissions that you apply to the file to determine how to display them in the Files tab. If you want different permissions, then apply them to the file. When you create it.