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

Error message when trying to save a file #1094

Closed
spyder-bot opened this issue Feb 17, 2015 · 14 comments
Closed

Error message when trying to save a file #1094

spyder-bot opened this issue Feb 17, 2015 · 14 comments

Comments

@spyder-bot
Copy link
Collaborator

From ageffe...@iris.cat on 2012-06-18T08:59:47Z

Spyder Version: 2.2.0dev
Python Version: 2.7.3
Qt Version: 4.8.1, PyQt4 (API v1) 4.9.1 on Linux

What steps will reproduce the problem?

1, Saving a file in editor.

When I run spyder --reset, then it is ok to save about 2 or 3 files, but after that it produces the error every time I try to save a file. At least for most files. What is the expected output? What do you see instead? I expect the file to be saved without a problem.
Instead I see messages like this:

"Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/spyderlib/plugins/editor.py", line 1586, in save
return editorstack.save(index=index, force=force)
File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/editor.py", line 1312, in save
self.emit(SIGNAL('file_saved(long,long)'), id(self), index)
TypeError: file_saved(long,long).emit(): argument 1 has unexpected type 'long'"

The file is, however, in most cases saved, but spyder does not recognize it is saved.

Please provide any additional information below

.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1094

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-07-04T07:38:58Z

I haven't seen this error, but it seems quite serious.

Several questions:

  1. How many files do you have opened when tryint to save?
  2. Are you trying to save from an Editor window? I mean, the one you can create using the option 'New window' from the Editor options menu?
  3. What distro are you using?

Summary: Error message when trying to save a file
Labels: Cat-Editor MS-v2.2

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-07-04T07:39:22Z

issue #1098 has been merged into this issue.

@spyder-bot
Copy link
Collaborator Author

From ageffe...@iris.cat on 2012-07-04T08:53:55Z

Hi,

first I have to tell that I protected the
"self.emit(SIGNAL('file_saved(long,long)'), id(self), index)" line with a try -- except block and since then everything seems to be working fine.
I admit I have no idea of what this line should be doing.
But anyway, I have no recent memory of how exactly the error is occuring.

  1. I didn't really observe any connection between number of files open and the error.
  2. No, I tried saving from the Editor part of the main spyder window.
    I never used the editor window, so I don't know if the error occurs there or not.
  3. I use Ubuntu 12.04

Let me know if you need any more details, I will try to collect more information for the above questions.

@spyder-bot
Copy link
Collaborator Author

From ageffe...@iris.cat on 2012-07-04T09:11:29Z

And also changed this line:

editor.go_to_line(clines[index])
to this:
editor.go_to_line(clines[min(index,len(clines)-1)])

(Around line 2000)

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-07-06T08:27:34Z

issue #1098 has been merged into this issue.

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-07-28T00:35:07Z

Handling the error by placing the code block in a try...except statement is not the right approach here as the signal is triggering actions to be performed when saving files.

Try moving tabs in the Console plugin, you should have the same kind of error if I understand it correctly.

Then using one of the attached patchs should work.
Please keep us posted.

Attachment: patch_for_v2.1.10.diff patch_for_v2.2.0dev.diff

@spyder-bot
Copy link
Collaborator Author

From pi...@synchrotron-soleil.fr on 2012-07-31T13:21:10Z

Hello pierre, I try to apply the patch for v2.1.10.diff but I can not apply it cleanly

with

patch -p1 < blabla.diff

is seems that the patch is for a windows machine and I am working on a unix one :)
(Stripping trailing CRs from patch.)
patching file spyderlib/plugins/editor.py
Hunk #1 FAILED at 997.
Hunk #2 FAILED at 1052.
2 out of 2 hunks FAILED -- saving rejects to file spyderlib/plugins/editor.py.rej
(Stripping trailing CRs from patch.)
patching file spyderlib/widgets/editor.py
Hunk #1 FAILED at 1194.
Hunk #2 FAILED at 1285.
Hunk #3 FAILED at 2327.
Hunk #4 FAILED at 2370.
4 out of 4 hunks FAILED -- saving rejects to file spyderlib/widgets/editor.py.rej
(Stripping trailing CRs from patch.)
patching file spyderlib/widgets/tabs.py
Hunk #1 FAILED at 76.
Hunk #2 FAILED at 246.
Hunk #3 FAILED at 303.
3 out of 3 hunks FAILED -- saving rejects to file spyderlib/widgets/tabs.py.rej

@spyder-bot
Copy link
Collaborator Author

From pi...@synchrotron-soleil.fr on 2012-07-31T13:24:05Z

picca@mordor:~/Debian/main/spyder/spyder$ file spyderlib/plugins/editor.py
spyderlib/plugins/editor.py: Python script, UTF-8 Unicode (with BOM) text executable, with CRLF line terminators

@spyder-bot
Copy link
Collaborator Author

From pi...@synchrotron-soleil.fr on 2012-07-31T13:47:45Z

ok, here a patch which works on top of 2.1.10 in Debian.

Attachment: 0003-from-upstream-fix-1098.patch

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-08-01T00:17:44Z

Ok, so apart from the Windows/Linux compatibility issue, I assume that the patch is working? (it's actually fixing this bug?)

Status: Started

@spyder-bot
Copy link
Collaborator Author

From ageffe...@iris.cat on 2012-08-01T01:25:41Z

hi Pierre,

so now I applied the patch. It wasn't easy, since I wasn't sure which version to patch against. And also wasn't sure which patch file to use.

I think I was using the 2.2.0dev version, originally but downloaded the latest widgets/editor.py from mercurial.

The 0003-from-upstream-fix-1098.patch worked on plugins/editor.py and on widgets/tabs.py, but not on widgets/editor.py. (not the 2.2.0dev and not the mercurial version)

Then I tried the patch_for_v2.2.0dev.diff which worked on widgets/editor.py but not on the other two.

I will try now and see how it works. But since my spyder is now getting to be a mess of many different versions, there is a pretty good chance that it won't.
Then I'll probably have to get the latest from mercurial.

Regarding moving tabs:
I have to admit I don't know how. Tried the obvious with the mouse, but didn't work.

@spyder-bot
Copy link
Collaborator Author

From ageffe...@iris.cat on 2012-08-01T02:42:45Z

It seems something is really messed up with my installation.
I get the following message when I try to set a breakpoint.

File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/editor.py", line 475, in breakpoints_changed
if self.editor.breakpoints != breakpoints:
AttributeError: 'CodeEditor' object has no attribute 'breakpoints'

It seems I have to reinstall

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-08-01T03:08:58Z

The patches that I've attached earlier should be working with the latest mercurial revisions of bothe v21 and default branches.

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-09-09T09:58:07Z

This issue was updated by revision 6260313cb49b .

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant