Geany ошибка при сохранении файла

Установил на Ubuntu 15.04 Geany версии 1.25.

При попытке сохранения файла выскакивает ошибка, как на скриншоте ниже. Подскажите, как можно пофиксить это.

Заранее благодарю.
Ошибка (скриншот)

задан 18 окт 2015 в 16:20

Bogdan's user avatar

2

вероятно, каталог и файлы, в которые вы пытаетесь внести изменения, принадлежат другому пользователю.

один из возможных вариантов «решения» — изменить принадлежность этих файлов/каталогов:

$ sudo chown $USER /путь/к/файлу/и/или/каталогу ...

или рекурсивно для всего содержимого каталога:

$ sudo chown -R $USER /путь/к/каталогу ...

ответ дан 18 окт 2015 в 20:19

aleksandr barakin's user avatar

aleksandr barakinaleksandr barakin

67.7k209 золотых знаков76 серебряных знаков218 бронзовых знаков

@rovf

I’m using Geany 1.30.1 on Windows 7.

After happily editing a file over some time, suddenly Geany refuses to save it with this error message:
capture_20170522_133456

I know that Windows sometimes grabs a lock on a file when I’m just looking at it with another tool, but I am pretty sure that the only way I’m operating on this file since the last bootup of my machine, is by editing it in Geany. Still, for the safe side, I run the Handle utility to see whether someone has a handle to either the file or the directory where the file is in — nothing. I also used Geany’s «File/Properties» to check, whether maybe the file secretly became readonly; this is also not the case. Finally I turned on the gio_unsafe_save_backup and tried again, but same result. Note that it is a local file, so there can’t be network issues involved either.

Then I tried «save as» with «rename», to store it under a new name in the same directory. This was refused with the same error message. I could see that the file got renamed, but still had the old content. This is weird: If the cause would be a directory lock, the rename should ALSO have failed.

Needless to say that it is not a disk space problem either.

I resolved the problem temporarily by using the following strategy:

  1. Using «Save as» to save it to a completely different directory.
  2. Copying the file back (on the command line)
  3. Closing the Buffer in Geany
  4. Reopening it

I then checked with my remaining open files in Geany. Modifying the buffer and saving, caused the same error with two of the files, while it worked fine with two others. One of the two where the error occured too, belonged to a different directory, while all the others — including those which could be saved — belonged to the same directory as the file where the problem occured initially.

I don’t see yet in what respect the two files which did not have the problem, differed significantly from the two files where the problem occured.

Closing Geany, starting it, and I can continue editing like normal, but my feeling is that it will be only a question of time until the problem occurs again. Is there anything I can do to help the Geany developers to nail down the cause of this strange problem?

@elextr

I am not a windows expert, but a couple of questions/suggestions.

The number one is, are you running any plugins? And if you are, does the problem occur when you run with no plugins?

I presume you retried the save and the «permission denied» continued after you had checked that nobody had a handle on the file?

Are you using windows native dialogs or GTK dialogs? And does the problem occur when you try the other? I vaguely remember something about dialogs having locks on files or directories because they read the metadata to populate the dialog.

IIRC the gio_unsafe_save_backup needs use_gio_unsafe_file_saving set as well.

Does the problem occur if you have neither use_atomic_file_saving nor use_gio_unsafe_file_saving nor gio_unsafe_save_backup set?

@rovf

(1) The number one is, are you running any plugins?

I’m not aware of. I have installed Geany today, and did not fiddle around with Plugins. Of course, it might be that Geany, out of the box, uses some Plugins which need to be disabled. In any case, the settings have a checkmark in «use plugins». If the pane which shows the map of my functions, is displayed by a plugin, then I would conclude that at least this plugin is running alongside.

(2) I presume you retried the save and the «permission denied» continued after you had checked that nobody had a handle on the file?

Of course, and, as I said, I for sure did not do anything with this file from a different program. Plus, the error occured on 3 files out of 5. And, I could save these files earlier in the same edit session.

(3) Are you using windows native dialogs or GTK dialogs?

They are GTK dialogs. I have now changed the settings to use Windows dialogues, but honestly, I like the GTK ones better.

(4) Does the problem occur if you have neither use_atomic_file_saving nor use_gio_unsafe_file_saving nor gio_unsafe_save_backup set?

Yes, the other ones were disabled as well, but this didn’t have any influence.

I wonder whether the problem might be related to a temporary directory or backup directory. Is Geany using some of them under the hood, maybe in my Windows Profile Data space? This is certainly an area which Geany should better keep its fingers off….

@rovf

ADDITIONAL NOTE: After continuing to edit my files (after restarting Geany) for maybe 15 minutes, the error occured again. It is not possible to save the file.

Unfortunately, this version of Geany is not usable for me. I will therefore switch to a different editor, BUTif one of the Geany maintainers wants me to try out something, I will of course turn back to Geany, because I want to help to find the bug.

@elextr

I have installed Geany today, and did not fiddle around with Plugins.

Ok, if its a new install and you didn’t enable any plugins in Tools->Plugin Manager then there should be none running, but maybe just check none are enabled in plugin manager.

Of course, and, as I said, I for sure did not do anything with this file from a different program. Plus, the error occured on 3 files out of 5. And, I could save these files earlier in the same edit session.

Thats fine, we have to check the obvious first :)

I have now changed the settings to use Windows dialogues, but honestly, I like the GTK ones better.

Let us know if the problem still occurs, the GTK dialogs are not something we build so I don’t know what they do, but I know they run extra threads, so maybe they trawl the filesystem to pre-load the dialogs, and I think I remember somewhere reports of them holding locks on stuff.

I wonder whether the problem might be related to a temporary directory or backup directory.

Other than its config directory that is saved in your user data (see Help->Debug Messages 4-5 down says where) Geany itself doesn’t fiddle with files other than your explicit save and load, but some plugins do, hence the first question.

Unfortunately, this version of Geany is not usable for me. I will therefore switch to a different editor, BUTif one of the Geany maintainers wants me to try out something, I will of course turn back to Geany, because I want to help to find the bug.

I presume that means the windows dialogs didn’t help :(

I know that there are some who use Geany on windows without problems, not sure if its 7 though, think its 10. Maybe they can provide some more suggestions on that might be unusual about your system.

@rovf

I presume that means the windows dialogs didn’t help :(

This is correct.

If someone could provide me a special, instrumented version, which logs what is going on during saving, I could run it until the problem occurs again, and then send the logs.

@codebrainz

I use it on Windows 7 and Windows 10 without this problem. All files I edit are local on the disk and both machines have my one user as an administrator. Not sure it helps.

Edit: Also both systems use all US-English locales and no files with non-ASCII filenames.
Edit2: Also I don’t use/have Cygwin at all, just using the offical Geany releases from the website.

@elextr

Just for some rainy day reading see my PHD thesis on saving files in Geany on the wiki.

If someone could provide me a special, instrumented version, which logs what is going on during saving, I could run it until the problem occurs again, and then send the logs.

As the wiki article says, two of the three saving methods are from libraries that we don’t control, so there is not much that can be done to see what is going on there. The third saving method is so simple that there is nothing to log, it exits on the first error and gives you a failure dialog.

The error message in German in your OP does not seem to be one of ours, suggesting that you were running one of the library saving methods when that occurred. Our message says «Failed to open file ‘%s’ for writing: fopen() failed: %s», and the German translation also contains the «fopen()» part which is missing in the dialog you posted. Please make very sure that you have all three of the options use_atomic_file_saving and use_gio_unsafe_file_saving and gio_unsafe_save_backup turned off.

Finally thank you for continuing to help track the problem down, as you understand, until we can replicate it we can’t do anything to fix it.

@agbai1

I am new to geany, and I use it to update html and php files for my server, and I ran into the same issue. I searched online and no luck, then I tried the
«sudo chmod 775 filename.xxx» (xxx could stand for php, js, or whatever type of file).
This allowed the file to execute when being called from the browser. I was also able to
«sudo nano filename.xxx»

So i decided to try the command «sudo geany» which prompted for my password as usual when you use sudo and it worked. I was able to save.

So using the command geany assumes you’re logged in as root, and if you are, you shouldn’t have permission issues, but if not, you need to «sudo » into geany

@elextr

«sudo nano filename.xxx»

If you have to sudo to edit the file you have your protections wrong, you need to fix them, not override them by running editors as root.

To be clear, the Geany team does NOT recommend running Geany as root, it is an IDE and some of the things it does as part of a normal development cycle may be security or other risks when run as root. You have been warned and you are responsible for any damage that may occur.

@konsolebox

«sudo nano filename.xxx»

I don’t agree with the avoid-root-at-all-cost paranoia, but you can minimize the «danger» by running the editor as the actual user that owns the file with sudo -u. You can also avoid creating a new file with wrong ownership.

So using the command geany assumes you’re logged in as root, and if you are, you shouldn’t have permission issues, but if not, you need to «sudo » into geany

So what exactly was the issue?

@Jaw2966

I know this is old, but for the people coming here to fix the problem for themselves. You’re probably saving in the «Geany» folder and trying to execute your file out of the folder. Try saving your file on your desktop.

@mvoelk

I have the same issue on network drives that I created with Win-SSHFS on Windows 10 and only in cases where the file already exist. The problem does not arise with other editors.

Geany 1.36

@MaximeG-51

Hello,
I have just experienced the same problem today (after years of using Geany seamlessly). Can this be related to the fact that I have tried to input Unicode characters like «É» just before (unsuccessfully, by the way…), which I think I had never done before?
At each attempt of file saving, I get a new file named .goutputstream-XXXXXX instead, with the content of the file I am trying to save.
Yours,
Maxime

@elextr

@MaximeG-51 when you say «input unicode characters» do you mean in the file contents or the filename?

@MaximeG-51

Hi,
In the file contents. I tried to type Éduterre. The «Alt-144» method I use in other Windows applications did not work, so I tried the Ctrl-Shift-u method described in the Geany Help, to no success. The file name does not contain any accented character (not even those that are directly on my French keyboard).
Yours,
Maxime

@elextr

Typing characters into the file is not part of this issue, if it failed to include the character it can have no effect on saving the file, but if you did manage to include it, and the Locale can’t store it in the file encoding, then save will fail, but with a different message to that which this issues is about.

I suggest you start a new issue and provide full system details and messages.

@gate222

Jaw2966 commented:
» I know this is old, but for the people coming here to fix the problem for themselves. You’re probably saving in the «Geany» folder and trying to execute your file out of the folder. Try saving your file on your desktop.»

This suggestion worked fine for me and appeared to cure the problem.

@rovf

I certainly don’t want the files to be stored in the Geany folder, and the Desktop doesn’t make even less sense, as this would leave my Desktop cluttered with icons for a file. As you can see from the screenshot of my original question, I have my project directories for storing the file. And I must add that meanwhile the error does not occur anymore. Either something was fixed in Geany, or there had been a Windows problem. Windows is really weird at times. For instance (this is not necessarily related to the problem I experienced back them), I do have an empty directory on Windows, which I had created long time ago, but can’t delete — not even with admin rights.

#python-3.x #save #geany

#python-3.x #Сохранить #geany

Вопрос:

В настоящее время я начинаю изучать Python в Windows 10 и для этого установил Geany 1.34.1 и Python 3.7.2 (с опцией PATH), как указано в моей книге.

Затем я создал новый файл и попытался сохранить его в какой-нибудь папке на моем диске C:, где находятся оба программного обеспечения.

К сожалению, я получаю следующую ошибку

Скриншот ошибки

Перевод (оригинал частично на французском):

«Ошибка при сохранении файла. Не удается открыть файл «C:UsersXXXDocumentspython_worktest.py » для записи: сбой функции fopen(): нет такого файла или каталога. Файл на диске может быть усечен»

Я также пробовал с Python IDLE и получаю ту же проблему, когда я не могу сохранить свой файл.

Я читал, что это может быть связано с тем, что в WIN мы используем , а в Unix / но я действительно не знаю, почему Geany не может самостоятельно выполнить перевод.

После нескольких часов неудачных попыток кто-нибудь может объяснить причину такого поведения?

Правка1: Расшифровка и перевод ошибки

Комментарии:

1. Можете ли вы предоставить ошибку в виде текста? Корпоративные прокси часто блокируют изображения (как в случае со мной), поэтому в вашем вопросе нет информации об ошибке. Текст также легче читать. Всегда используйте текст вместо изображений, где это возможно.

2. @Ken White: я соответствующим образом отредактировал сообщение. Спасибо за ваш совет, я сделаю это в будущем.

3. Может быть связано с этой открытой в данный момент ошибкой: github.com/geany/geany/issues/1500

4. @davedwards спасибо за поиск. Я уже прочитал это и сначала подумал, что это всего лишь проблема, связанная с Geany, но затем, к сожалению, я сталкиваюсь с такой же ошибкой при сохранении с помощью «IDLE», что наводит меня на мысль, что Geany не несет полной ответственности.

5. @endlessend2525, Можете ли вы сохранить любой простой текстовый файл в этот "python_work" каталог (например, "afile.txt" с помощью встроенного инструмента Windows, такого как Windows Notepad)? Похоже, что в этом каталоге "python_work" могут быть ограничения на разрешение записи. Возможно, проверьте права доступа к каталогам в свойствах папки.

Ответ №1:

Я думаю, это потому, что в python и в других языках программирования «» используется для некоторого специального символа. Например, ‘ n’ = новая строка, я не совсем уверен, но я думаю, что именно по этой причине у меня вначале были похожие проблемы.

Комментарии:

1. Спасибо за ваш вклад. Я это тоже понял, но здесь я даже не пишу код. Я просто нажимаю «Сохранить как», а затем выбираю папку, указываю имя «test.py «и это все.

2. IDLE выдает вам эту ошибку при попытке сохранить пустой файл с именем test.py верно?

3. Файл сохраняется в Geany или Idle, поэтому то, для чего python или другие языки программирования используют обратную косую черту, не имеет значения. Если проблемы возникли с кодом poster, ваш ответ мог бы быть уместным, но его здесь нет.

4. @KenWhite да, я так и думал, поэтому я быстро исключил эту возможность. Жаль, что я действительно не могу использовать python на своем компьютере.

Ответ №2:

Обнаружена проблема.

Убедитесь, что отключено следующее:

Защитник Windows> Защита от вирусов и угроз > Параметры защиты от вирусов и угроз > Контролируемый доступ к папке> Отключен

I think, with bugs in general, frequency of occurance is hard to guess. For example, in the majority of my past projects, I was the only one who actually reported issues with software. Most other people either ignored the problem, or switch to a different software. Especially in the case of a free text editor, by far most users who experience this kind of problem more than once, will simple turn to a different program.

Yes you’re correct, so, since the local psychic is on summer holidays, all we can use is reporting frequency. As for the assumption it may be scaring away users, this is one of the rare situations where I agree with RMS (program name removed):

We would like more people to use <our program>, but we should never think
that we _need_ more users.  When developers of a free software package
think they _need_ more users, it is a lever that can be used
to push them into bad decisions.

When some people use <our program>, they are getting benefit from our work.
We are glad it benefits them, we intended it to benefit users, and we
hope to make it benefit them more, but we don't _need_ them to be
pleased with our work.  We're the ones who did them a favor -- not
vice versa.

Likewise, when some people don't use <our program>, that's their loss, not our
loss.

So we tend to do stuff for us, then those who report it, and not those who don’t. Now you have reported it, we are looking for a solution, but not at the cost of reducing service to the flakey network brigade who have already contributed reports in the past.

Sorry to go all philosophical on your Issue, now back to normal service :)

I don’t know to what extent the network is flakey, but in many companies, it is strongly discouraged to have any file on your local drive (becaue it doesn’t get up).

«backed up» I assume you mean, yes, thats why simply refusing to save «remote» files is a «bad thing» ™️. «Remote» files can be connected via local gigabit connections that are more reliable than the disk drive, to connections to a remote server via coffee shop wi-fi or overloaded zero strength cell connections using sshfs, we don’t know.

The problem is not so much editing over the network, but editing files which are accessible to many people, and of course this can lead to race conditions, which would also exist if I would copy the file to my local disk, and write it back when I’m done.

Well, as @codebrainz pointed out, failure to save can still be triggered on local files too, and on Linux, for example if you or one of your scripts changed the file permissions, or the disk filled up.

The plugin needs to make sure that the clock counting until the next attempt of saving the file, is reset to zero when the user clicks the OK button of the pop-up message. He has then time to save the file under a different name (if he sees no possibility to remove the lock).

It would have to disable the «save on focus out» feature, because, having had the popup, a focus_out event is already queued to re-trigger the sequence, thats where the loop is. The question is then when to re-enable it since the user doing save-as does not involve or inform the plugin its done.

Also I’m not sure its possible to reset or cancel the timer, you have to actually get a timeout and return false, @b4n would know. But the timer triggered saves should not be a problem (well it might be if the user set a really small timeout, but that will cause a problem in their normal usage, so its not likely), you might get one extra timer triggered save and failure dialog, but once you start the save-as process it can’t be interrupted because the dialogs are modal (thats why the dialogs are modal :).

But someone has to come up with a good suggestion on how to re-enable the plugin, or how to otherwise break the focus-out loop long enough to save. Because the alternative of disabling the plugin and notifying the user via a popup dialog is going to be an issue for the flakey network brigade who will get it regularly.

В настоящее время я начинаю изучать Python в Windows 10, и для этого я установил Geany 1.34.1 и Python 3.7.2 (с параметром PATH), как указано в моей книге.

Затем я создал новый файл и попытался сохранить его в какой-то папке на моем диске C:, где находятся оба программного обеспечения.

К сожалению, я получаю следующую ошибку

Невозможно сохранить файл python ни в одной среде IDE

Перевод (оригинал частично на французском):

«Ошибка при сохранении файла. Не удалось открыть файл «C:UsersXXXDocumentspython_worktest.py» для записи: fopen() не удалось: нет такого файла или каталога. Файл на диске может быть усеченный»

Я также пытался использовать Python IDLE и столкнулся с той же проблемой, когда не могу сохранить свой файл.

Я читал, что это может быть связано с тем, что в WIN мы используем , а в Unix /, но я действительно не знаю, почему Geany не может сделать перевод в одиночку.

Кто-нибудь может объяснить причину такого поведения после нескольких часов ударов и промахов?

Edit1: Транскрипция и перевод ошибки

Перейти к ответу
Данный вопрос помечен как решенный


Ответы
2

Я думаю, это потому, что в python и других языках программирования «» используется для некоторых специальных символов.
Например ‘n’ = новая строка
Я не совсем уверен, но я думаю, что именно по этой причине у меня были похожие проблемы в начале.

Нашел проблему.

Убедитесь, что следующие деактивированы:

Защитник Windows > Защита от вирусов и угроз > Настройки защиты от вирусов и угроз > Контролируемый доступ к папкам > Отключено

Другие вопросы по теме

Возможно, вам также будет интересно:

  • Gdmss lite ошибка подключения что делать
  • Gdiplus dll как исправить ошибку
  • Gdi32full dll windows 10 ошибка
  • Gdi как считать ошибки
  • Gdi windows explorer exe ошибка приложения

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии